{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "# How To Build An Agentic Chatbot With Claude 3.5 Sonnet, LangGraph and MongoDB\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {},
      "source": [
        "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/mongodb-developer/GenAI-Showcase/blob/main/notebooks/agents/hr_agentic_chatbot_with_langgraph_claude.ipynb)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "izlZCG-2sKuU"
      },
      "source": [
        "## Install Libraries"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 1,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "wTgqaoO11BaR",
        "outputId": "d1493947-c68a-4167-9b70-251507424a2c"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m89.0/89.0 kB\u001b[0m \u001b[31m837.2 kB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.2/2.2 MB\u001b[0m \u001b[31m14.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m45.9/45.9 kB\u001b[0m \u001b[31m5.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m127.5/127.5 kB\u001b[0m \u001b[31m6.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m337.4/337.4 kB\u001b[0m \u001b[31m25.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m975.5/975.5 kB\u001b[0m \u001b[31m15.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m863.9/863.9 kB\u001b[0m \u001b[31m26.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m328.3/328.3 kB\u001b[0m \u001b[31m21.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.1/1.1 MB\u001b[0m \u001b[31m34.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.2/1.2 MB\u001b[0m \u001b[31m60.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m141.1/141.1 kB\u001b[0m \u001b[31m16.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m75.6/75.6 kB\u001b[0m \u001b[31m8.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m318.9/318.9 kB\u001b[0m \u001b[31m31.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m49.2/49.2 kB\u001b[0m \u001b[31m5.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m307.7/307.7 kB\u001b[0m \u001b[31m32.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m77.9/77.9 kB\u001b[0m \u001b[31m8.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.3/58.3 kB\u001b[0m \u001b[31m6.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m13.0/13.0 MB\u001b[0m \u001b[31m48.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
            "\u001b[?25h\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
            "cudf-cu12 24.4.1 requires pandas<2.2.2dev0,>=2.0, but you have pandas 2.2.2 which is incompatible.\n",
            "google-colab 1.0.0 requires pandas==2.0.3, but you have pandas 2.2.2 which is incompatible.\u001b[0m\u001b[31m\n",
            "\u001b[0m"
          ]
        }
      ],
      "source": [
        "!pip install -U --quiet langgraph langchain-community langchain-anthropic langchain-openai langchain-mongodb langsmith\n",
        "!pip install -U --quiet pandas openai pymongo"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "eYb_MHZhsQlY"
      },
      "source": [
        "## Set Environment Variables"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 2,
      "metadata": {
        "id": "icL2Bf7Z_j0a"
      },
      "outputs": [],
      "source": [
        "import os\n",
        "\n",
        "os.environ[\"OPENAI_API_KEY\"] = \"\"\n",
        "OPENAI_API_KEY = os.environ.get(\"OPENAI_API_KEY\")\n",
        "\n",
        "os.environ[\"ANTHROPIC_API_KEY\"] = \"\"\n",
        "ANTHROPIC_API_KEY = os.environ.get(\"ANTHROPIC_API_KEY\")\n",
        "\n",
        "OPEN_AI_EMBEDDING_MODEL = \"text-embedding-3-small\"\n",
        "OPEN_AI_EMBEDDING_MODEL_DIMENSION = 256\n",
        "\n",
        "os.environ[\"LANGCHAIN_TRACING_V2\"] = \"true\"\n",
        "os.environ[\"LANGCHAIN_API_KEY\"] = \"\"\n",
        "os.environ[\"LANGCHAIN_ENDPOINT\"] = \"https://api.smith.langchain.com\"\n",
        "os.environ[\"LANGCHAIN_PROJECT\"] = \"hr_agentic_chatbot\""
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "4Mgx24z3sTpY"
      },
      "source": [
        "## Synthetic Data Generation"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 3,
      "metadata": {
        "id": "jdIBuTvyAL9e"
      },
      "outputs": [],
      "source": [
        "import random\n",
        "\n",
        "import pandas as pd\n",
        "\n",
        "# Define a list of job titles and departments for variety\n",
        "job_titles = [\n",
        "    \"Software Engineer\",\n",
        "    \"Senior Software Engineer\",\n",
        "    \"Data Scientist\",\n",
        "    \"Product Manager\",\n",
        "    \"Project Manager\",\n",
        "    \"UX Designer\",\n",
        "    \"QA Engineer\",\n",
        "    \"DevOps Engineer\",\n",
        "    \"CTO\",\n",
        "    \"CEO\",\n",
        "]\n",
        "departments = [\n",
        "    \"IT\",\n",
        "    \"Engineering\",\n",
        "    \"Data Science\",\n",
        "    \"Product\",\n",
        "    \"Project Management\",\n",
        "    \"Design\",\n",
        "    \"Quality Assurance\",\n",
        "    \"Operations\",\n",
        "    \"Executive\",\n",
        "]\n",
        "\n",
        "# Define a list of office locations\n",
        "office_locations = [\n",
        "    \"Chicago Office\",\n",
        "    \"New York Office\",\n",
        "    \"London Office\",\n",
        "    \"Berlin Office\",\n",
        "    \"Tokyo Office\",\n",
        "    \"Sydney Office\",\n",
        "    \"Toronto Office\",\n",
        "    \"San Francisco Office\",\n",
        "    \"Paris Office\",\n",
        "    \"Singapore Office\",\n",
        "]\n",
        "\n",
        "\n",
        "# Define a function to create a random employee entry\n",
        "def create_employee(\n",
        "    employee_id, first_name, last_name, job_title, department, manager_id=None\n",
        "):\n",
        "    return {\n",
        "        \"employee_id\": employee_id,\n",
        "        \"first_name\": first_name,\n",
        "        \"last_name\": last_name,\n",
        "        \"gender\": random.choice([\"Male\", \"Female\"]),\n",
        "        \"date_of_birth\": f\"{random.randint(1950, 2000)}-{random.randint(1, 12):02}-{random.randint(1, 28):02}\",\n",
        "        \"address\": {\n",
        "            \"street\": f\"{random.randint(100, 999)} Main Street\",\n",
        "            \"city\": \"Springfield\",\n",
        "            \"state\": \"IL\",\n",
        "            \"postal_code\": \"62704\",\n",
        "            \"country\": \"USA\",\n",
        "        },\n",
        "        \"contact_details\": {\n",
        "            \"email\": f\"{first_name.lower()}.{last_name.lower()}@example.com\",\n",
        "            \"phone_number\": f\"+1-555-{random.randint(100, 999)}-{random.randint(1000, 9999)}\",\n",
        "        },\n",
        "        \"job_details\": {\n",
        "            \"job_title\": job_title,\n",
        "            \"department\": department,\n",
        "            \"hire_date\": f\"{random.randint(2000, 2022)}-{random.randint(1, 12):02}-{random.randint(1, 28):02}\",\n",
        "            \"employment_type\": \"Full-Time\",\n",
        "            \"salary\": random.randint(50000, 250000),\n",
        "            \"currency\": \"USD\",\n",
        "        },\n",
        "        \"work_location\": {\n",
        "            \"nearest_office\": random.choice(office_locations),\n",
        "            \"is_remote\": random.choice([True, False]),\n",
        "        },\n",
        "        \"reporting_manager\": manager_id,\n",
        "        \"skills\": random.sample(\n",
        "            [\n",
        "                \"JavaScript\",\n",
        "                \"Python\",\n",
        "                \"Node.js\",\n",
        "                \"React\",\n",
        "                \"Django\",\n",
        "                \"Flask\",\n",
        "                \"AWS\",\n",
        "                \"Docker\",\n",
        "                \"Kubernetes\",\n",
        "                \"SQL\",\n",
        "            ],\n",
        "            4,\n",
        "        ),\n",
        "        \"performance_reviews\": [\n",
        "            {\n",
        "                \"review_date\": f\"{random.randint(2020, 2023)}-{random.randint(1, 12):02}-{random.randint(1, 28):02}\",\n",
        "                \"rating\": round(random.uniform(3, 5), 1),\n",
        "                \"comments\": random.choice(\n",
        "                    [\n",
        "                        \"Exceeded expectations in the last project.\",\n",
        "                        \"Consistently meets performance standards.\",\n",
        "                        \"Needs improvement in time management.\",\n",
        "                        \"Outstanding performance and dedication.\",\n",
        "                    ]\n",
        "                ),\n",
        "            },\n",
        "            {\n",
        "                \"review_date\": f\"{random.randint(2019, 2022)}-{random.randint(1, 12):02}-{random.randint(1, 28):02}\",\n",
        "                \"rating\": round(random.uniform(3, 5), 1),\n",
        "                \"comments\": random.choice(\n",
        "                    [\n",
        "                        \"Exceeded expectations in the last project.\",\n",
        "                        \"Consistently meets performance standards.\",\n",
        "                        \"Needs improvement in time management.\",\n",
        "                        \"Outstanding performance and dedication.\",\n",
        "                    ]\n",
        "                ),\n",
        "            },\n",
        "        ],\n",
        "        \"benefits\": {\n",
        "            \"health_insurance\": random.choice(\n",
        "                [\"Gold Plan\", \"Silver Plan\", \"Bronze Plan\"]\n",
        "            ),\n",
        "            \"retirement_plan\": \"401K\",\n",
        "            \"paid_time_off\": random.randint(15, 30),\n",
        "        },\n",
        "        \"emergency_contact\": {\n",
        "            \"name\": f\"{random.choice(['Jane', 'Emily', 'Michael', 'Robert'])} {random.choice(['Doe', 'Smith', 'Johnson'])}\",\n",
        "            \"relationship\": random.choice([\"Spouse\", \"Parent\", \"Sibling\", \"Friend\"]),\n",
        "            \"phone_number\": f\"+1-555-{random.randint(100, 999)}-{random.randint(1000, 9999)}\",\n",
        "        },\n",
        "        \"notes\": random.choice(\n",
        "            [\n",
        "                \"Promoted to Senior Software Engineer in 2020.\",\n",
        "                \"Completed leadership training in 2021.\",\n",
        "                \"Received Employee of the Month award in 2022.\",\n",
        "                \"Actively involved in company hackathons and innovation challenges.\",\n",
        "            ]\n",
        "        ),\n",
        "    }\n",
        "\n",
        "\n",
        "# Generate 10 employee entries\n",
        "employees = [\n",
        "    create_employee(\"E123456\", \"John\", \"Doe\", \"Software Engineer\", \"IT\", \"M987654\"),\n",
        "    create_employee(\n",
        "        \"E123457\", \"Jane\", \"Doe\", \"Senior Software Engineer\", \"IT\", \"M987654\"\n",
        "    ),\n",
        "    create_employee(\n",
        "        \"E123458\", \"Emily\", \"Smith\", \"Data Scientist\", \"Data Science\", \"M987655\"\n",
        "    ),\n",
        "    create_employee(\n",
        "        \"E123459\", \"Michael\", \"Brown\", \"Product Manager\", \"Product\", \"M987656\"\n",
        "    ),\n",
        "    create_employee(\n",
        "        \"E123460\", \"Sarah\", \"Davis\", \"Project Manager\", \"Project Management\", \"M987657\"\n",
        "    ),\n",
        "    create_employee(\"E123461\", \"Robert\", \"Johnson\", \"UX Designer\", \"Design\", \"M987658\"),\n",
        "    create_employee(\n",
        "        \"E123462\", \"David\", \"Wilson\", \"QA Engineer\", \"Quality Assurance\", \"M987659\"\n",
        "    ),\n",
        "    create_employee(\n",
        "        \"E123463\", \"Chris\", \"Lee\", \"DevOps Engineer\", \"Operations\", \"M987660\"\n",
        "    ),\n",
        "    create_employee(\"E123464\", \"Sophia\", \"Garcia\", \"CTO\", \"Executive\", None),\n",
        "    create_employee(\"E123465\", \"Olivia\", \"Martinez\", \"CEO\", \"Executive\", None),\n",
        "]"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 4,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "HgACLedwARUv",
        "outputId": "57fd6a6b-49f8-43df-f74b-2e3ad784b68b"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Synthetic employee data has been saved to synthetic_data_employees.csv\n"
          ]
        }
      ],
      "source": [
        "# Convert to DataFrame\n",
        "df_employees = pd.DataFrame(employees)\n",
        "\n",
        "# Save DataFrame to CSV\n",
        "csv_file_employees = \"synthetic_data_employees.csv\"\n",
        "df_employees.to_csv(csv_file_employees, index=False)\n",
        "\n",
        "print(f\"Synthetic employee data has been saved to {csv_file_employees}\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 5,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 660
        },
        "id": "TqrAA0YIATym",
        "outputId": "a353ed5f-cc86-457d-a7bd-355299ab02c4"
      },
      "outputs": [
        {
          "data": {
            "application/vnd.google.colaboratory.intrinsic+json": {
              "summary": "{\n  \"name\": \"df_employees\",\n  \"rows\": 10,\n  \"fields\": [\n    {\n      \"column\": \"employee_id\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 10,\n        \"samples\": [\n          \"E123464\",\n          \"E123457\",\n          \"E123461\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"first_name\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 10,\n        \"samples\": [\n          \"Sophia\",\n          \"Jane\",\n          \"Robert\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"last_name\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 9,\n        \"samples\": [\n          \"Garcia\",\n          \"Smith\",\n          \"Wilson\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"gender\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 2,\n        \"samples\": [\n          \"Female\",\n          \"Male\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"date_of_birth\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"num_unique_values\": 10,\n        \"samples\": [\n          \"1971-05-23\",\n          \"1975-02-11\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"address\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"contact_details\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"job_details\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"work_location\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"reporting_manager\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 7,\n        \"samples\": [\n          \"M987654\",\n          \"M987655\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"skills\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"performance_reviews\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"benefits\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"emergency_contact\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"notes\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 3,\n        \"samples\": [\n          \"Completed leadership training in 2021.\",\n          \"Received Employee of the Month award in 2022.\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}",
              "type": "dataframe",
              "variable_name": "df_employees"
            },
            "text/html": [
              "\n",
              "  <div id=\"df-209ee08e-b8f4-4c7c-b0fd-a4f08759b2bd\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>employee_id</th>\n",
              "      <th>first_name</th>\n",
              "      <th>last_name</th>\n",
              "      <th>gender</th>\n",
              "      <th>date_of_birth</th>\n",
              "      <th>address</th>\n",
              "      <th>contact_details</th>\n",
              "      <th>job_details</th>\n",
              "      <th>work_location</th>\n",
              "      <th>reporting_manager</th>\n",
              "      <th>skills</th>\n",
              "      <th>performance_reviews</th>\n",
              "      <th>benefits</th>\n",
              "      <th>emergency_contact</th>\n",
              "      <th>notes</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>E123456</td>\n",
              "      <td>John</td>\n",
              "      <td>Doe</td>\n",
              "      <td>Male</td>\n",
              "      <td>1988-01-17</td>\n",
              "      <td>{'street': '637 Main Street', 'city': 'Springf...</td>\n",
              "      <td>{'email': 'john.doe@example.com', 'phone_numbe...</td>\n",
              "      <td>{'job_title': 'Software Engineer', 'department...</td>\n",
              "      <td>{'nearest_office': 'Paris Office', 'is_remote'...</td>\n",
              "      <td>M987654</td>\n",
              "      <td>[Flask, AWS, Kubernetes, JavaScript]</td>\n",
              "      <td>[{'review_date': '2020-12-26', 'rating': 4.2, ...</td>\n",
              "      <td>{'health_insurance': 'Gold Plan', 'retirement_...</td>\n",
              "      <td>{'name': 'Jane Smith', 'relationship': 'Spouse...</td>\n",
              "      <td>Completed leadership training in 2021.</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>E123457</td>\n",
              "      <td>Jane</td>\n",
              "      <td>Doe</td>\n",
              "      <td>Male</td>\n",
              "      <td>1975-02-11</td>\n",
              "      <td>{'street': '776 Main Street', 'city': 'Springf...</td>\n",
              "      <td>{'email': 'jane.doe@example.com', 'phone_numbe...</td>\n",
              "      <td>{'job_title': 'Senior Software Engineer', 'dep...</td>\n",
              "      <td>{'nearest_office': 'Berlin Office', 'is_remote...</td>\n",
              "      <td>M987654</td>\n",
              "      <td>[AWS, Django, React, Python]</td>\n",
              "      <td>[{'review_date': '2021-09-23', 'rating': 3.4, ...</td>\n",
              "      <td>{'health_insurance': 'Silver Plan', 'retiremen...</td>\n",
              "      <td>{'name': 'Emily Doe', 'relationship': 'Spouse'...</td>\n",
              "      <td>Received Employee of the Month award in 2022.</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>E123458</td>\n",
              "      <td>Emily</td>\n",
              "      <td>Smith</td>\n",
              "      <td>Male</td>\n",
              "      <td>1996-04-26</td>\n",
              "      <td>{'street': '613 Main Street', 'city': 'Springf...</td>\n",
              "      <td>{'email': 'emily.smith@example.com', 'phone_nu...</td>\n",
              "      <td>{'job_title': 'Data Scientist', 'department': ...</td>\n",
              "      <td>{'nearest_office': 'Paris Office', 'is_remote'...</td>\n",
              "      <td>M987655</td>\n",
              "      <td>[Flask, AWS, Kubernetes, Python]</td>\n",
              "      <td>[{'review_date': '2021-08-27', 'rating': 4.3, ...</td>\n",
              "      <td>{'health_insurance': 'Gold Plan', 'retirement_...</td>\n",
              "      <td>{'name': 'Robert Smith', 'relationship': 'Sibl...</td>\n",
              "      <td>Promoted to Senior Software Engineer in 2020.</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>E123459</td>\n",
              "      <td>Michael</td>\n",
              "      <td>Brown</td>\n",
              "      <td>Female</td>\n",
              "      <td>1975-09-03</td>\n",
              "      <td>{'street': '887 Main Street', 'city': 'Springf...</td>\n",
              "      <td>{'email': 'michael.brown@example.com', 'phone_...</td>\n",
              "      <td>{'job_title': 'Product Manager', 'department':...</td>\n",
              "      <td>{'nearest_office': 'Sydney Office', 'is_remote...</td>\n",
              "      <td>M987656</td>\n",
              "      <td>[Kubernetes, SQL, React, Python]</td>\n",
              "      <td>[{'review_date': '2021-03-16', 'rating': 3.7, ...</td>\n",
              "      <td>{'health_insurance': 'Gold Plan', 'retirement_...</td>\n",
              "      <td>{'name': 'Emily Johnson', 'relationship': 'Sib...</td>\n",
              "      <td>Promoted to Senior Software Engineer in 2020.</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>E123460</td>\n",
              "      <td>Sarah</td>\n",
              "      <td>Davis</td>\n",
              "      <td>Female</td>\n",
              "      <td>1999-02-08</td>\n",
              "      <td>{'street': '468 Main Street', 'city': 'Springf...</td>\n",
              "      <td>{'email': 'sarah.davis@example.com', 'phone_nu...</td>\n",
              "      <td>{'job_title': 'Project Manager', 'department':...</td>\n",
              "      <td>{'nearest_office': 'Toronto Office', 'is_remot...</td>\n",
              "      <td>M987657</td>\n",
              "      <td>[AWS, Kubernetes, Node.js, SQL]</td>\n",
              "      <td>[{'review_date': '2022-06-01', 'rating': 3.1, ...</td>\n",
              "      <td>{'health_insurance': 'Silver Plan', 'retiremen...</td>\n",
              "      <td>{'name': 'Emily Doe', 'relationship': 'Friend'...</td>\n",
              "      <td>Completed leadership training in 2021.</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-209ee08e-b8f4-4c7c-b0fd-a4f08759b2bd')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-209ee08e-b8f4-4c7c-b0fd-a4f08759b2bd button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-209ee08e-b8f4-4c7c-b0fd-a4f08759b2bd');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "<div id=\"df-e456fd68-4ac6-485d-ab93-03e6568c0e85\">\n",
              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-e456fd68-4ac6-485d-ab93-03e6568c0e85')\"\n",
              "            title=\"Suggest charts\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "  </button>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "      --bg-color: #E8F0FE;\n",
              "      --fill-color: #1967D2;\n",
              "      --hover-bg-color: #E2EBFA;\n",
              "      --hover-fill-color: #174EA6;\n",
              "      --disabled-fill-color: #AAA;\n",
              "      --disabled-bg-color: #DDD;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "      --bg-color: #3B4455;\n",
              "      --fill-color: #D2E3FC;\n",
              "      --hover-bg-color: #434B5C;\n",
              "      --hover-fill-color: #FFFFFF;\n",
              "      --disabled-bg-color: #3B4455;\n",
              "      --disabled-fill-color: #666;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart {\n",
              "    background-color: var(--bg-color);\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: var(--fill-color);\n",
              "    height: 32px;\n",
              "    padding: 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: var(--hover-bg-color);\n",
              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: var(--button-hover-fill-color);\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart-complete:disabled,\n",
              "  .colab-df-quickchart-complete:disabled:hover {\n",
              "    background-color: var(--disabled-bg-color);\n",
              "    fill: var(--disabled-fill-color);\n",
              "    box-shadow: none;\n",
              "  }\n",
              "\n",
              "  .colab-df-spinner {\n",
              "    border: 2px solid var(--fill-color);\n",
              "    border-color: transparent;\n",
              "    border-bottom-color: var(--fill-color);\n",
              "    animation:\n",
              "      spin 1s steps(1) infinite;\n",
              "  }\n",
              "\n",
              "  @keyframes spin {\n",
              "    0% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "      border-left-color: var(--fill-color);\n",
              "    }\n",
              "    20% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    30% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    40% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    60% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    80% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "    90% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "  }\n",
              "</style>\n",
              "\n",
              "  <script>\n",
              "    async function quickchart(key) {\n",
              "      const quickchartButtonEl =\n",
              "        document.querySelector('#' + key + ' button');\n",
              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
              "      try {\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      } catch (error) {\n",
              "        console.error('Error during call to suggestCharts:', error);\n",
              "      }\n",
              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
              "    }\n",
              "    (() => {\n",
              "      let quickchartButtonEl =\n",
              "        document.querySelector('#df-e456fd68-4ac6-485d-ab93-03e6568c0e85 button');\n",
              "      quickchartButtonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "    })();\n",
              "  </script>\n",
              "</div>\n",
              "\n",
              "    </div>\n",
              "  </div>\n"
            ],
            "text/plain": [
              "  employee_id first_name last_name  gender date_of_birth  \\\n",
              "0     E123456       John       Doe    Male    1988-01-17   \n",
              "1     E123457       Jane       Doe    Male    1975-02-11   \n",
              "2     E123458      Emily     Smith    Male    1996-04-26   \n",
              "3     E123459    Michael     Brown  Female    1975-09-03   \n",
              "4     E123460      Sarah     Davis  Female    1999-02-08   \n",
              "\n",
              "                                             address  \\\n",
              "0  {'street': '637 Main Street', 'city': 'Springf...   \n",
              "1  {'street': '776 Main Street', 'city': 'Springf...   \n",
              "2  {'street': '613 Main Street', 'city': 'Springf...   \n",
              "3  {'street': '887 Main Street', 'city': 'Springf...   \n",
              "4  {'street': '468 Main Street', 'city': 'Springf...   \n",
              "\n",
              "                                     contact_details  \\\n",
              "0  {'email': 'john.doe@example.com', 'phone_numbe...   \n",
              "1  {'email': 'jane.doe@example.com', 'phone_numbe...   \n",
              "2  {'email': 'emily.smith@example.com', 'phone_nu...   \n",
              "3  {'email': 'michael.brown@example.com', 'phone_...   \n",
              "4  {'email': 'sarah.davis@example.com', 'phone_nu...   \n",
              "\n",
              "                                         job_details  \\\n",
              "0  {'job_title': 'Software Engineer', 'department...   \n",
              "1  {'job_title': 'Senior Software Engineer', 'dep...   \n",
              "2  {'job_title': 'Data Scientist', 'department': ...   \n",
              "3  {'job_title': 'Product Manager', 'department':...   \n",
              "4  {'job_title': 'Project Manager', 'department':...   \n",
              "\n",
              "                                       work_location reporting_manager  \\\n",
              "0  {'nearest_office': 'Paris Office', 'is_remote'...           M987654   \n",
              "1  {'nearest_office': 'Berlin Office', 'is_remote...           M987654   \n",
              "2  {'nearest_office': 'Paris Office', 'is_remote'...           M987655   \n",
              "3  {'nearest_office': 'Sydney Office', 'is_remote...           M987656   \n",
              "4  {'nearest_office': 'Toronto Office', 'is_remot...           M987657   \n",
              "\n",
              "                                 skills  \\\n",
              "0  [Flask, AWS, Kubernetes, JavaScript]   \n",
              "1          [AWS, Django, React, Python]   \n",
              "2      [Flask, AWS, Kubernetes, Python]   \n",
              "3      [Kubernetes, SQL, React, Python]   \n",
              "4       [AWS, Kubernetes, Node.js, SQL]   \n",
              "\n",
              "                                 performance_reviews  \\\n",
              "0  [{'review_date': '2020-12-26', 'rating': 4.2, ...   \n",
              "1  [{'review_date': '2021-09-23', 'rating': 3.4, ...   \n",
              "2  [{'review_date': '2021-08-27', 'rating': 4.3, ...   \n",
              "3  [{'review_date': '2021-03-16', 'rating': 3.7, ...   \n",
              "4  [{'review_date': '2022-06-01', 'rating': 3.1, ...   \n",
              "\n",
              "                                            benefits  \\\n",
              "0  {'health_insurance': 'Gold Plan', 'retirement_...   \n",
              "1  {'health_insurance': 'Silver Plan', 'retiremen...   \n",
              "2  {'health_insurance': 'Gold Plan', 'retirement_...   \n",
              "3  {'health_insurance': 'Gold Plan', 'retirement_...   \n",
              "4  {'health_insurance': 'Silver Plan', 'retiremen...   \n",
              "\n",
              "                                   emergency_contact  \\\n",
              "0  {'name': 'Jane Smith', 'relationship': 'Spouse...   \n",
              "1  {'name': 'Emily Doe', 'relationship': 'Spouse'...   \n",
              "2  {'name': 'Robert Smith', 'relationship': 'Sibl...   \n",
              "3  {'name': 'Emily Johnson', 'relationship': 'Sib...   \n",
              "4  {'name': 'Emily Doe', 'relationship': 'Friend'...   \n",
              "\n",
              "                                           notes  \n",
              "0         Completed leadership training in 2021.  \n",
              "1  Received Employee of the Month award in 2022.  \n",
              "2  Promoted to Senior Software Engineer in 2020.  \n",
              "3  Promoted to Senior Software Engineer in 2020.  \n",
              "4         Completed leadership training in 2021.  "
            ]
          },
          "execution_count": 5,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "df_employees.head()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "6_nOCUy6saFD"
      },
      "source": [
        "## Embedding Generation"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 6,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "27Y6EZtZAbHu",
        "outputId": "970708ca-375e-419c-d50d-276fdc001aa6"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Here's what an employee string looks like: /n John Doe, Male, born on 1988-01-17. Job: Software Engineer in IT. Skills: Flask, AWS, Kubernetes, JavaScript. Reviews: Rated 4.2 on 2020-12-26: Outstanding performance and dedication. Rated 3.8 on 2020-03-09: Consistently meets performance standards.. Location: Works at Paris Office, Remote: False. Notes: Completed leadership training in 2021.\n"
          ]
        }
      ],
      "source": [
        "# Function to create a string representation of the employee's key attributes for embedding\n",
        "def create_employee_string(employee):\n",
        "    job_details = f\"{employee['job_details']['job_title']} in {employee['job_details']['department']}\"\n",
        "    skills = \", \".join(employee[\"skills\"])\n",
        "    performance_reviews = \" \".join(\n",
        "        [\n",
        "            f\"Rated {review['rating']} on {review['review_date']}: {review['comments']}\"\n",
        "            for review in employee[\"performance_reviews\"]\n",
        "        ]\n",
        "    )\n",
        "    basic_info = f\"{employee['first_name']} {employee['last_name']}, {employee['gender']}, born on {employee['date_of_birth']}\"\n",
        "    work_location = f\"Works at {employee['work_location']['nearest_office']}, Remote: {employee['work_location']['is_remote']}\"\n",
        "    notes = employee[\"notes\"]\n",
        "\n",
        "    return f\"{basic_info}. Job: {job_details}. Skills: {skills}. Reviews: {performance_reviews}. Location: {work_location}. Notes: {notes}\"\n",
        "\n",
        "\n",
        "# Example usage with one employee\n",
        "employee_string = create_employee_string(employees[0])\n",
        "print(f\"Here's what an employee string looks like: /n {employee_string}\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 7,
      "metadata": {
        "id": "RBf_aRkbAdZK"
      },
      "outputs": [],
      "source": [
        "# Apply the function to all employees\n",
        "df_employees[\"employee_string\"] = df_employees.apply(create_employee_string, axis=1)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 8,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "lB-vfPbXAmGU",
        "outputId": "9e65cd39-a084-459d-c013-52928102828f"
      },
      "outputs": [
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "100%|██████████| 10/10 [00:00<00:00, 33261.73it/s]"
          ]
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Embeddings generated for employees\n"
          ]
        },
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "\n"
          ]
        }
      ],
      "source": [
        "import openai\n",
        "from tqdm import tqdm\n",
        "\n",
        "\n",
        "# Generate an embedding using OpenAI's API\n",
        "def get_embedding(text):\n",
        "    \"\"\"Generate an embedding for the given text using OpenAI's API.\"\"\"\n",
        "\n",
        "    # Check for valid input\n",
        "    if not text or not isinstance(text, str):\n",
        "        return None\n",
        "\n",
        "    try:\n",
        "        # Call OpenAI API to get the embedding\n",
        "        embedding = (\n",
        "            openai.embeddings.create(\n",
        "                input=text,\n",
        "                model=OPEN_AI_EMBEDDING_MODEL,\n",
        "                dimensions=OPEN_AI_EMBEDDING_MODEL_DIMENSION,\n",
        "            )\n",
        "            .data[0]\n",
        "            .embedding\n",
        "        )\n",
        "        return embedding\n",
        "    except Exception as e:\n",
        "        print(f\"Error in get_embedding: {e}\")\n",
        "        return None\n",
        "\n",
        "\n",
        "# Apply the function to generate embeddings for all employees with error handling and progress tracking\n",
        "try:\n",
        "    df_employees[\"embedding\"] = [\n",
        "        x\n",
        "        for x in tqdm(\n",
        "            df_employees[\"employee_string\"].apply(get_embedding),\n",
        "            total=len(df_employees),\n",
        "        )\n",
        "    ]\n",
        "    print(\"Embeddings generated for employees\")\n",
        "except Exception as e:\n",
        "    print(f\"Error applying embedding function to DataFrame: {e}\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 9,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 660
        },
        "id": "LW7uo-r-AoWU",
        "outputId": "39a272db-2cd8-4157-9ccc-4dddc3d27439"
      },
      "outputs": [
        {
          "data": {
            "application/vnd.google.colaboratory.intrinsic+json": {
              "summary": "{\n  \"name\": \"df_employees\",\n  \"rows\": 10,\n  \"fields\": [\n    {\n      \"column\": \"employee_id\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 10,\n        \"samples\": [\n          \"E123464\",\n          \"E123457\",\n          \"E123461\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"first_name\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 10,\n        \"samples\": [\n          \"Sophia\",\n          \"Jane\",\n          \"Robert\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"last_name\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 9,\n        \"samples\": [\n          \"Garcia\",\n          \"Smith\",\n          \"Wilson\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"gender\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 2,\n        \"samples\": [\n          \"Female\",\n          \"Male\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"date_of_birth\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"num_unique_values\": 10,\n        \"samples\": [\n          \"1971-05-23\",\n          \"1975-02-11\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"address\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"contact_details\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"job_details\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"work_location\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"reporting_manager\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 7,\n        \"samples\": [\n          \"M987654\",\n          \"M987655\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"skills\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"performance_reviews\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"benefits\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"emergency_contact\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"notes\",\n      \"properties\": {\n        \"dtype\": \"category\",\n        \"num_unique_values\": 3,\n        \"samples\": [\n          \"Completed leadership training in 2021.\",\n          \"Received Employee of the Month award in 2022.\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"employee_string\",\n      \"properties\": {\n        \"dtype\": \"string\",\n        \"num_unique_values\": 10,\n        \"samples\": [\n          \"Sophia Garcia, Male, born on 1971-05-23. Job: CTO in Executive. Skills: Django, SQL, JavaScript, React. Reviews: Rated 4.2 on 2023-11-25: Outstanding performance and dedication. Rated 3.8 on 2021-06-06: Outstanding performance and dedication.. Location: Works at Chicago Office, Remote: True. Notes: Completed leadership training in 2021.\",\n          \"Jane Doe, Male, born on 1975-02-11. Job: Senior Software Engineer in IT. Skills: AWS, Django, React, Python. Reviews: Rated 3.4 on 2021-09-23: Outstanding performance and dedication. Rated 4.8 on 2019-02-23: Outstanding performance and dedication.. Location: Works at Berlin Office, Remote: True. Notes: Received Employee of the Month award in 2022.\"\n        ],\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    },\n    {\n      \"column\": \"embedding\",\n      \"properties\": {\n        \"dtype\": \"object\",\n        \"semantic_type\": \"\",\n        \"description\": \"\"\n      }\n    }\n  ]\n}",
              "type": "dataframe",
              "variable_name": "df_employees"
            },
            "text/html": [
              "\n",
              "  <div id=\"df-baf5550e-7d37-49bd-8509-6853bda0b5d0\" class=\"colab-df-container\">\n",
              "    <div>\n",
              "<style scoped>\n",
              "    .dataframe tbody tr th:only-of-type {\n",
              "        vertical-align: middle;\n",
              "    }\n",
              "\n",
              "    .dataframe tbody tr th {\n",
              "        vertical-align: top;\n",
              "    }\n",
              "\n",
              "    .dataframe thead th {\n",
              "        text-align: right;\n",
              "    }\n",
              "</style>\n",
              "<table border=\"1\" class=\"dataframe\">\n",
              "  <thead>\n",
              "    <tr style=\"text-align: right;\">\n",
              "      <th></th>\n",
              "      <th>employee_id</th>\n",
              "      <th>first_name</th>\n",
              "      <th>last_name</th>\n",
              "      <th>gender</th>\n",
              "      <th>date_of_birth</th>\n",
              "      <th>address</th>\n",
              "      <th>contact_details</th>\n",
              "      <th>job_details</th>\n",
              "      <th>work_location</th>\n",
              "      <th>reporting_manager</th>\n",
              "      <th>skills</th>\n",
              "      <th>performance_reviews</th>\n",
              "      <th>benefits</th>\n",
              "      <th>emergency_contact</th>\n",
              "      <th>notes</th>\n",
              "      <th>employee_string</th>\n",
              "      <th>embedding</th>\n",
              "    </tr>\n",
              "  </thead>\n",
              "  <tbody>\n",
              "    <tr>\n",
              "      <th>0</th>\n",
              "      <td>E123456</td>\n",
              "      <td>John</td>\n",
              "      <td>Doe</td>\n",
              "      <td>Male</td>\n",
              "      <td>1988-01-17</td>\n",
              "      <td>{'street': '637 Main Street', 'city': 'Springf...</td>\n",
              "      <td>{'email': 'john.doe@example.com', 'phone_numbe...</td>\n",
              "      <td>{'job_title': 'Software Engineer', 'department...</td>\n",
              "      <td>{'nearest_office': 'Paris Office', 'is_remote'...</td>\n",
              "      <td>M987654</td>\n",
              "      <td>[Flask, AWS, Kubernetes, JavaScript]</td>\n",
              "      <td>[{'review_date': '2020-12-26', 'rating': 4.2, ...</td>\n",
              "      <td>{'health_insurance': 'Gold Plan', 'retirement_...</td>\n",
              "      <td>{'name': 'Jane Smith', 'relationship': 'Spouse...</td>\n",
              "      <td>Completed leadership training in 2021.</td>\n",
              "      <td>John Doe, Male, born on 1988-01-17. Job: Softw...</td>\n",
              "      <td>[-0.0711723044514656, 0.04006121680140495, 0.0...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>1</th>\n",
              "      <td>E123457</td>\n",
              "      <td>Jane</td>\n",
              "      <td>Doe</td>\n",
              "      <td>Male</td>\n",
              "      <td>1975-02-11</td>\n",
              "      <td>{'street': '776 Main Street', 'city': 'Springf...</td>\n",
              "      <td>{'email': 'jane.doe@example.com', 'phone_numbe...</td>\n",
              "      <td>{'job_title': 'Senior Software Engineer', 'dep...</td>\n",
              "      <td>{'nearest_office': 'Berlin Office', 'is_remote...</td>\n",
              "      <td>M987654</td>\n",
              "      <td>[AWS, Django, React, Python]</td>\n",
              "      <td>[{'review_date': '2021-09-23', 'rating': 3.4, ...</td>\n",
              "      <td>{'health_insurance': 'Silver Plan', 'retiremen...</td>\n",
              "      <td>{'name': 'Emily Doe', 'relationship': 'Spouse'...</td>\n",
              "      <td>Received Employee of the Month award in 2022.</td>\n",
              "      <td>Jane Doe, Male, born on 1975-02-11. Job: Senio...</td>\n",
              "      <td>[-0.017159942537546158, 0.04259845241904259, 0...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>2</th>\n",
              "      <td>E123458</td>\n",
              "      <td>Emily</td>\n",
              "      <td>Smith</td>\n",
              "      <td>Male</td>\n",
              "      <td>1996-04-26</td>\n",
              "      <td>{'street': '613 Main Street', 'city': 'Springf...</td>\n",
              "      <td>{'email': 'emily.smith@example.com', 'phone_nu...</td>\n",
              "      <td>{'job_title': 'Data Scientist', 'department': ...</td>\n",
              "      <td>{'nearest_office': 'Paris Office', 'is_remote'...</td>\n",
              "      <td>M987655</td>\n",
              "      <td>[Flask, AWS, Kubernetes, Python]</td>\n",
              "      <td>[{'review_date': '2021-08-27', 'rating': 4.3, ...</td>\n",
              "      <td>{'health_insurance': 'Gold Plan', 'retirement_...</td>\n",
              "      <td>{'name': 'Robert Smith', 'relationship': 'Sibl...</td>\n",
              "      <td>Promoted to Senior Software Engineer in 2020.</td>\n",
              "      <td>Emily Smith, Male, born on 1996-04-26. Job: Da...</td>\n",
              "      <td>[0.003667315933853388, 0.029469972476363182, 0...</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>3</th>\n",
              "      <td>E123459</td>\n",
              "      <td>Michael</td>\n",
              "      <td>Brown</td>\n",
              "      <td>Female</td>\n",
              "      <td>1975-09-03</td>\n",
              "      <td>{'street': '887 Main Street', 'city': 'Springf...</td>\n",
              "      <td>{'email': 'michael.brown@example.com', 'phone_...</td>\n",
              "      <td>{'job_title': 'Product Manager', 'department':...</td>\n",
              "      <td>{'nearest_office': 'Sydney Office', 'is_remote...</td>\n",
              "      <td>M987656</td>\n",
              "      <td>[Kubernetes, SQL, React, Python]</td>\n",
              "      <td>[{'review_date': '2021-03-16', 'rating': 3.7, ...</td>\n",
              "      <td>{'health_insurance': 'Gold Plan', 'retirement_...</td>\n",
              "      <td>{'name': 'Emily Johnson', 'relationship': 'Sib...</td>\n",
              "      <td>Promoted to Senior Software Engineer in 2020.</td>\n",
              "      <td>Michael Brown, Female, born on 1975-09-03. Job...</td>\n",
              "      <td>[-0.0264598298817873, 0.030107785016298294, 0....</td>\n",
              "    </tr>\n",
              "    <tr>\n",
              "      <th>4</th>\n",
              "      <td>E123460</td>\n",
              "      <td>Sarah</td>\n",
              "      <td>Davis</td>\n",
              "      <td>Female</td>\n",
              "      <td>1999-02-08</td>\n",
              "      <td>{'street': '468 Main Street', 'city': 'Springf...</td>\n",
              "      <td>{'email': 'sarah.davis@example.com', 'phone_nu...</td>\n",
              "      <td>{'job_title': 'Project Manager', 'department':...</td>\n",
              "      <td>{'nearest_office': 'Toronto Office', 'is_remot...</td>\n",
              "      <td>M987657</td>\n",
              "      <td>[AWS, Kubernetes, Node.js, SQL]</td>\n",
              "      <td>[{'review_date': '2022-06-01', 'rating': 3.1, ...</td>\n",
              "      <td>{'health_insurance': 'Silver Plan', 'retiremen...</td>\n",
              "      <td>{'name': 'Emily Doe', 'relationship': 'Friend'...</td>\n",
              "      <td>Completed leadership training in 2021.</td>\n",
              "      <td>Sarah Davis, Female, born on 1999-02-08. Job: ...</td>\n",
              "      <td>[0.011142105795443058, 0.020625432953238487, 0...</td>\n",
              "    </tr>\n",
              "  </tbody>\n",
              "</table>\n",
              "</div>\n",
              "    <div class=\"colab-df-buttons\">\n",
              "\n",
              "  <div class=\"colab-df-container\">\n",
              "    <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-baf5550e-7d37-49bd-8509-6853bda0b5d0')\"\n",
              "            title=\"Convert this dataframe to an interactive table.\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "  <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\">\n",
              "    <path d=\"M120-120v-720h720v720H120Zm60-500h600v-160H180v160Zm220 220h160v-160H400v160Zm0 220h160v-160H400v160ZM180-400h160v-160H180v160Zm440 0h160v-160H620v160ZM180-180h160v-160H180v160Zm440 0h160v-160H620v160Z\"/>\n",
              "  </svg>\n",
              "    </button>\n",
              "\n",
              "  <style>\n",
              "    .colab-df-container {\n",
              "      display:flex;\n",
              "      gap: 12px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert {\n",
              "      background-color: #E8F0FE;\n",
              "      border: none;\n",
              "      border-radius: 50%;\n",
              "      cursor: pointer;\n",
              "      display: none;\n",
              "      fill: #1967D2;\n",
              "      height: 32px;\n",
              "      padding: 0 0 0 0;\n",
              "      width: 32px;\n",
              "    }\n",
              "\n",
              "    .colab-df-convert:hover {\n",
              "      background-color: #E2EBFA;\n",
              "      box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "      fill: #174EA6;\n",
              "    }\n",
              "\n",
              "    .colab-df-buttons div {\n",
              "      margin-bottom: 4px;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert {\n",
              "      background-color: #3B4455;\n",
              "      fill: #D2E3FC;\n",
              "    }\n",
              "\n",
              "    [theme=dark] .colab-df-convert:hover {\n",
              "      background-color: #434B5C;\n",
              "      box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
              "      filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
              "      fill: #FFFFFF;\n",
              "    }\n",
              "  </style>\n",
              "\n",
              "    <script>\n",
              "      const buttonEl =\n",
              "        document.querySelector('#df-baf5550e-7d37-49bd-8509-6853bda0b5d0 button.colab-df-convert');\n",
              "      buttonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "\n",
              "      async function convertToInteractive(key) {\n",
              "        const element = document.querySelector('#df-baf5550e-7d37-49bd-8509-6853bda0b5d0');\n",
              "        const dataTable =\n",
              "          await google.colab.kernel.invokeFunction('convertToInteractive',\n",
              "                                                    [key], {});\n",
              "        if (!dataTable) return;\n",
              "\n",
              "        const docLinkHtml = 'Like what you see? Visit the ' +\n",
              "          '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
              "          + ' to learn more about interactive tables.';\n",
              "        element.innerHTML = '';\n",
              "        dataTable['output_type'] = 'display_data';\n",
              "        await google.colab.output.renderOutput(dataTable, element);\n",
              "        const docLink = document.createElement('div');\n",
              "        docLink.innerHTML = docLinkHtml;\n",
              "        element.appendChild(docLink);\n",
              "      }\n",
              "    </script>\n",
              "  </div>\n",
              "\n",
              "\n",
              "<div id=\"df-597fbcf9-f0f5-4d97-a0c1-3e4e11826f80\">\n",
              "  <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-597fbcf9-f0f5-4d97-a0c1-3e4e11826f80')\"\n",
              "            title=\"Suggest charts\"\n",
              "            style=\"display:none;\">\n",
              "\n",
              "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
              "     width=\"24px\">\n",
              "    <g>\n",
              "        <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
              "    </g>\n",
              "</svg>\n",
              "  </button>\n",
              "\n",
              "<style>\n",
              "  .colab-df-quickchart {\n",
              "      --bg-color: #E8F0FE;\n",
              "      --fill-color: #1967D2;\n",
              "      --hover-bg-color: #E2EBFA;\n",
              "      --hover-fill-color: #174EA6;\n",
              "      --disabled-fill-color: #AAA;\n",
              "      --disabled-bg-color: #DDD;\n",
              "  }\n",
              "\n",
              "  [theme=dark] .colab-df-quickchart {\n",
              "      --bg-color: #3B4455;\n",
              "      --fill-color: #D2E3FC;\n",
              "      --hover-bg-color: #434B5C;\n",
              "      --hover-fill-color: #FFFFFF;\n",
              "      --disabled-bg-color: #3B4455;\n",
              "      --disabled-fill-color: #666;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart {\n",
              "    background-color: var(--bg-color);\n",
              "    border: none;\n",
              "    border-radius: 50%;\n",
              "    cursor: pointer;\n",
              "    display: none;\n",
              "    fill: var(--fill-color);\n",
              "    height: 32px;\n",
              "    padding: 0;\n",
              "    width: 32px;\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart:hover {\n",
              "    background-color: var(--hover-bg-color);\n",
              "    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
              "    fill: var(--button-hover-fill-color);\n",
              "  }\n",
              "\n",
              "  .colab-df-quickchart-complete:disabled,\n",
              "  .colab-df-quickchart-complete:disabled:hover {\n",
              "    background-color: var(--disabled-bg-color);\n",
              "    fill: var(--disabled-fill-color);\n",
              "    box-shadow: none;\n",
              "  }\n",
              "\n",
              "  .colab-df-spinner {\n",
              "    border: 2px solid var(--fill-color);\n",
              "    border-color: transparent;\n",
              "    border-bottom-color: var(--fill-color);\n",
              "    animation:\n",
              "      spin 1s steps(1) infinite;\n",
              "  }\n",
              "\n",
              "  @keyframes spin {\n",
              "    0% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "      border-left-color: var(--fill-color);\n",
              "    }\n",
              "    20% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    30% {\n",
              "      border-color: transparent;\n",
              "      border-left-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    40% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-top-color: var(--fill-color);\n",
              "    }\n",
              "    60% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "    }\n",
              "    80% {\n",
              "      border-color: transparent;\n",
              "      border-right-color: var(--fill-color);\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "    90% {\n",
              "      border-color: transparent;\n",
              "      border-bottom-color: var(--fill-color);\n",
              "    }\n",
              "  }\n",
              "</style>\n",
              "\n",
              "  <script>\n",
              "    async function quickchart(key) {\n",
              "      const quickchartButtonEl =\n",
              "        document.querySelector('#' + key + ' button');\n",
              "      quickchartButtonEl.disabled = true;  // To prevent multiple clicks.\n",
              "      quickchartButtonEl.classList.add('colab-df-spinner');\n",
              "      try {\n",
              "        const charts = await google.colab.kernel.invokeFunction(\n",
              "            'suggestCharts', [key], {});\n",
              "      } catch (error) {\n",
              "        console.error('Error during call to suggestCharts:', error);\n",
              "      }\n",
              "      quickchartButtonEl.classList.remove('colab-df-spinner');\n",
              "      quickchartButtonEl.classList.add('colab-df-quickchart-complete');\n",
              "    }\n",
              "    (() => {\n",
              "      let quickchartButtonEl =\n",
              "        document.querySelector('#df-597fbcf9-f0f5-4d97-a0c1-3e4e11826f80 button');\n",
              "      quickchartButtonEl.style.display =\n",
              "        google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
              "    })();\n",
              "  </script>\n",
              "</div>\n",
              "\n",
              "    </div>\n",
              "  </div>\n"
            ],
            "text/plain": [
              "  employee_id first_name last_name  gender date_of_birth  \\\n",
              "0     E123456       John       Doe    Male    1988-01-17   \n",
              "1     E123457       Jane       Doe    Male    1975-02-11   \n",
              "2     E123458      Emily     Smith    Male    1996-04-26   \n",
              "3     E123459    Michael     Brown  Female    1975-09-03   \n",
              "4     E123460      Sarah     Davis  Female    1999-02-08   \n",
              "\n",
              "                                             address  \\\n",
              "0  {'street': '637 Main Street', 'city': 'Springf...   \n",
              "1  {'street': '776 Main Street', 'city': 'Springf...   \n",
              "2  {'street': '613 Main Street', 'city': 'Springf...   \n",
              "3  {'street': '887 Main Street', 'city': 'Springf...   \n",
              "4  {'street': '468 Main Street', 'city': 'Springf...   \n",
              "\n",
              "                                     contact_details  \\\n",
              "0  {'email': 'john.doe@example.com', 'phone_numbe...   \n",
              "1  {'email': 'jane.doe@example.com', 'phone_numbe...   \n",
              "2  {'email': 'emily.smith@example.com', 'phone_nu...   \n",
              "3  {'email': 'michael.brown@example.com', 'phone_...   \n",
              "4  {'email': 'sarah.davis@example.com', 'phone_nu...   \n",
              "\n",
              "                                         job_details  \\\n",
              "0  {'job_title': 'Software Engineer', 'department...   \n",
              "1  {'job_title': 'Senior Software Engineer', 'dep...   \n",
              "2  {'job_title': 'Data Scientist', 'department': ...   \n",
              "3  {'job_title': 'Product Manager', 'department':...   \n",
              "4  {'job_title': 'Project Manager', 'department':...   \n",
              "\n",
              "                                       work_location reporting_manager  \\\n",
              "0  {'nearest_office': 'Paris Office', 'is_remote'...           M987654   \n",
              "1  {'nearest_office': 'Berlin Office', 'is_remote...           M987654   \n",
              "2  {'nearest_office': 'Paris Office', 'is_remote'...           M987655   \n",
              "3  {'nearest_office': 'Sydney Office', 'is_remote...           M987656   \n",
              "4  {'nearest_office': 'Toronto Office', 'is_remot...           M987657   \n",
              "\n",
              "                                 skills  \\\n",
              "0  [Flask, AWS, Kubernetes, JavaScript]   \n",
              "1          [AWS, Django, React, Python]   \n",
              "2      [Flask, AWS, Kubernetes, Python]   \n",
              "3      [Kubernetes, SQL, React, Python]   \n",
              "4       [AWS, Kubernetes, Node.js, SQL]   \n",
              "\n",
              "                                 performance_reviews  \\\n",
              "0  [{'review_date': '2020-12-26', 'rating': 4.2, ...   \n",
              "1  [{'review_date': '2021-09-23', 'rating': 3.4, ...   \n",
              "2  [{'review_date': '2021-08-27', 'rating': 4.3, ...   \n",
              "3  [{'review_date': '2021-03-16', 'rating': 3.7, ...   \n",
              "4  [{'review_date': '2022-06-01', 'rating': 3.1, ...   \n",
              "\n",
              "                                            benefits  \\\n",
              "0  {'health_insurance': 'Gold Plan', 'retirement_...   \n",
              "1  {'health_insurance': 'Silver Plan', 'retiremen...   \n",
              "2  {'health_insurance': 'Gold Plan', 'retirement_...   \n",
              "3  {'health_insurance': 'Gold Plan', 'retirement_...   \n",
              "4  {'health_insurance': 'Silver Plan', 'retiremen...   \n",
              "\n",
              "                                   emergency_contact  \\\n",
              "0  {'name': 'Jane Smith', 'relationship': 'Spouse...   \n",
              "1  {'name': 'Emily Doe', 'relationship': 'Spouse'...   \n",
              "2  {'name': 'Robert Smith', 'relationship': 'Sibl...   \n",
              "3  {'name': 'Emily Johnson', 'relationship': 'Sib...   \n",
              "4  {'name': 'Emily Doe', 'relationship': 'Friend'...   \n",
              "\n",
              "                                           notes  \\\n",
              "0         Completed leadership training in 2021.   \n",
              "1  Received Employee of the Month award in 2022.   \n",
              "2  Promoted to Senior Software Engineer in 2020.   \n",
              "3  Promoted to Senior Software Engineer in 2020.   \n",
              "4         Completed leadership training in 2021.   \n",
              "\n",
              "                                     employee_string  \\\n",
              "0  John Doe, Male, born on 1988-01-17. Job: Softw...   \n",
              "1  Jane Doe, Male, born on 1975-02-11. Job: Senio...   \n",
              "2  Emily Smith, Male, born on 1996-04-26. Job: Da...   \n",
              "3  Michael Brown, Female, born on 1975-09-03. Job...   \n",
              "4  Sarah Davis, Female, born on 1999-02-08. Job: ...   \n",
              "\n",
              "                                           embedding  \n",
              "0  [-0.0711723044514656, 0.04006121680140495, 0.0...  \n",
              "1  [-0.017159942537546158, 0.04259845241904259, 0...  \n",
              "2  [0.003667315933853388, 0.029469972476363182, 0...  \n",
              "3  [-0.0264598298817873, 0.030107785016298294, 0....  \n",
              "4  [0.011142105795443058, 0.020625432953238487, 0...  "
            ]
          },
          "execution_count": 9,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "# Observe the new 'embedding' coloumn\n",
        "df_employees.head()"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "9HlKX45JsgS-"
      },
      "source": [
        "## MongoDB Database Setup"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "y2Nd6pgdBHpW"
      },
      "source": [
        "\n",
        "**Steps to creating a MongoDB Database**\n",
        "- [Register for a free MongoDB Atlas Account](https://www.mongodb.com/cloud/atlas/register?utm_campaign=devrel&utm_source=workshop&utm_medium=organic_social&utm_content=rag%20to%20agents%20notebook&utm_term=richmond.alake)\n",
        "- [Create a Cluster](https://www.mongodb.com/docs/guides/atlas/cluster/)\n",
        "- [Get your connection string](https://www.mongodb.com/docs/guides/atlas/connection-string/)\n",
        "\n",
        "\n",
        "\n"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 10,
      "metadata": {
        "id": "t7DfHeDjBJTo"
      },
      "outputs": [],
      "source": [
        "os.environ[\"MONGO_URI\"] = \"\"\n",
        "\n",
        "MONGO_URI = os.environ.get(\"MONGO_URI\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 11,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "Wfskd-DyBZXl",
        "outputId": "d2ce2c93-e117-4350-b216-c6332bdf1be6"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Connection to MongoDB successful\n"
          ]
        }
      ],
      "source": [
        "from pymongo.mongo_client import MongoClient\n",
        "\n",
        "DATABASE_NAME = \"demo_company_employees\"\n",
        "COLLECTION_NAME = \"employees_records\"\n",
        "\n",
        "\n",
        "def get_mongo_client(mongo_uri):\n",
        "    \"\"\"Establish connection to the MongoDB and ping the database.\"\"\"\n",
        "\n",
        "    # gateway to interacting with a MongoDB database cluster\n",
        "    client = MongoClient(mongo_uri, appname=\"devrel.showcase.hr_agent.python\")\n",
        "\n",
        "    # Ping the database to ensure the connection is successful\n",
        "    try:\n",
        "        client.admin.command(\"ping\")\n",
        "        print(\"Connection to MongoDB successful\")\n",
        "    except Exception as e:\n",
        "        print(f\"Error connecting to MongoDB: {e}\")\n",
        "        return None\n",
        "\n",
        "    return client\n",
        "\n",
        "\n",
        "if not MONGO_URI:\n",
        "    print(\"MONGO_URI not set in environment variables\")\n",
        "\n",
        "mongo_client = get_mongo_client(MONGO_URI)\n",
        "\n",
        "if mongo_client:\n",
        "    # Pymongo client of database and collection\n",
        "    db = mongo_client.get_database(DATABASE_NAME)\n",
        "    collection = db.get_collection(COLLECTION_NAME)\n",
        "else:\n",
        "    print(\"Failed to connect to MongoDB. Exiting...\")\n",
        "    exit(1)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "eUi4PTGpsq92"
      },
      "source": [
        "## Data Ingestion"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 12,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "yuFO7s2OCBLS",
        "outputId": "b9c4dbf0-889a-4fa8-b4c8-df827b90beab"
      },
      "outputs": [
        {
          "data": {
            "text/plain": [
              "DeleteResult({'n': 10, 'electionId': ObjectId('7fffffff000000000000002a'), 'opTime': {'ts': Timestamp(1720096850, 10), 't': 42}, 'ok': 1.0, '$clusterTime': {'clusterTime': Timestamp(1720096850, 10), 'signature': {'hash': b'DG\\xd3GP)\\xfd\\xb5\\xe5\\x9a\\x1e\\xcfG\\x82\\xff\\xbes\\xfb\\xa4A', 'keyId': 7353740577831124994}}, 'operationTime': Timestamp(1720096850, 10)}, acknowledged=True)"
            ]
          },
          "execution_count": 12,
          "metadata": {},
          "output_type": "execute_result"
        }
      ],
      "source": [
        "# Clean up collection of exisiting record\n",
        "collection.delete_many({})"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 13,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "srfPwL0OBdS_",
        "outputId": "6006202a-7af9-47ce-f53b-29e26111f2f2"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Data ingestion into MongoDB completed\n"
          ]
        }
      ],
      "source": [
        "documents = df_employees.to_dict(\"records\")\n",
        "\n",
        "# Ingest data into MongoDB Database\n",
        "collection.insert_many(documents)\n",
        "print(\"Data ingestion into MongoDB completed\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "JzDJWZIws1lW"
      },
      "source": [
        "## Vector Search Index Initalisation"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "_mtAdAJUCMBM"
      },
      "source": [
        "1.4 Vector Index Creation\n",
        "\n",
        "- [Create an Atlas Vector Search Index](https://www.mongodb.com/docs/compass/current/indexes/create-vector-search-index/)\n",
        "\n",
        "- If you are following this notebook ensure that you are creating a vector search index for the right database(demo_company_employees) and collection(employees_records)\n",
        "\n",
        "Below is the vector search index definition for this notebook\n",
        "\n",
        "```json\n",
        "{\n",
        "  \"fields\": [\n",
        "    {\n",
        "      \"numDimensions\": 256,\n",
        "      \"path\": \"embedding\",\n",
        "      \"similarity\": \"cosine\",\n",
        "      \"type\": \"vector\"\n",
        "    }\n",
        "  ]\n",
        "}\n",
        "```\n",
        "\n",
        "- Give your vector search index the name \"vector_index\" if you are following this notebook\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "Ry0ATezkuoxo"
      },
      "source": [
        "## Agentic System Memory"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 14,
      "metadata": {
        "id": "BbsjVID8owUp"
      },
      "outputs": [],
      "source": [
        "from langchain_mongodb.chat_message_histories import MongoDBChatMessageHistory\n",
        "\n",
        "\n",
        "def get_session_history(session_id: str) -> MongoDBChatMessageHistory:\n",
        "    return MongoDBChatMessageHistory(\n",
        "        MONGO_URI, session_id, database_name=DATABASE_NAME, collection_name=\"history\"\n",
        "    )\n",
        "\n",
        "\n",
        "temp_mem = get_session_history(\"test\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "g78EgfqXuvDe"
      },
      "source": [
        "## LLM Definition"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 15,
      "metadata": {
        "id": "hhhLoYAGRdph"
      },
      "outputs": [],
      "source": [
        "from langchain_anthropic import ChatAnthropic\n",
        "\n",
        "# llm = ChatOpenAI(model=\"gpt-4o-2024-05-13\", temperature=0)\n",
        "llm = ChatAnthropic(model=\"claude-3-5-sonnet-20240620\", temperature=0)"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "ckDtP1S_DDsx"
      },
      "source": [
        "## Tool Definition"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 16,
      "metadata": {
        "id": "uCW3pXcvCM1Y"
      },
      "outputs": [],
      "source": [
        "from langchain.agents import tool\n",
        "from langchain_mongodb import MongoDBAtlasVectorSearch\n",
        "from langchain_openai import OpenAIEmbeddings\n",
        "\n",
        "ATLAS_VECTOR_SEARCH_INDEX = \"vector_index\"\n",
        "embedding_model = OpenAIEmbeddings(\n",
        "    model=OPEN_AI_EMBEDDING_MODEL, dimensions=OPEN_AI_EMBEDDING_MODEL_DIMENSION\n",
        ")\n",
        "\n",
        "# Vector Store Creation\n",
        "vector_store = MongoDBAtlasVectorSearch.from_connection_string(\n",
        "    connection_string=MONGO_URI,\n",
        "    namespace=DATABASE_NAME + \".\" + COLLECTION_NAME,\n",
        "    embedding=embedding_model,\n",
        "    index_name=ATLAS_VECTOR_SEARCH_INDEX,\n",
        "    text_key=\"employee_string\",\n",
        ")\n",
        "\n",
        "\n",
        "@tool\n",
        "def lookup_employees(query: str, n=10) -> str:\n",
        "    \"Gathers employee details from the database\"\n",
        "    result = vector_store.similarity_search_with_score(query=query, k=n)\n",
        "    return str(result)\n",
        "\n",
        "\n",
        "tools = [lookup_employees]"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "yDwa0K-ju2J3"
      },
      "source": [
        "## Agent Definition"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 17,
      "metadata": {
        "id": "7euVmnMWR6Q7"
      },
      "outputs": [],
      "source": [
        "from datetime import datetime\n",
        "\n",
        "from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder\n",
        "\n",
        "\n",
        "def create_agent(llm, tools, system_message: str):\n",
        "    \"\"\"Create an agent.\"\"\"\n",
        "\n",
        "    prompt = ChatPromptTemplate.from_messages(\n",
        "        [\n",
        "            (\n",
        "                \"system\",\n",
        "                \"You are a helpful AI assistant, collaborating with other assistants.\"\n",
        "                \" Use the provided tools to progress towards answering the question.\"\n",
        "                \" If you are unable to fully answer, that's OK, another assistant with different tools \"\n",
        "                \" will help where you left off. Execute what you can to make progress.\"\n",
        "                \" If you or any of the other assistants have the final answer or deliverable,\"\n",
        "                \" prefix your response with FINAL ANSWER so the team knows to stop.\"\n",
        "                \" You have access to the following tools: {tool_names}.\\n{system_message}\"\n",
        "                \"\\nCurrent time: {time}.\",\n",
        "            ),\n",
        "            MessagesPlaceholder(variable_name=\"messages\"),\n",
        "        ]\n",
        "    )\n",
        "    prompt = prompt.partial(system_message=system_message)\n",
        "    prompt = prompt.partial(time=lambda: str(datetime.now()))\n",
        "    prompt = prompt.partial(tool_names=\", \".join([tool.name for tool in tools]))\n",
        "\n",
        "    return prompt | llm.bind_tools(tools)"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 18,
      "metadata": {
        "id": "K10U7EL8Sy7r"
      },
      "outputs": [],
      "source": [
        "# Chatbot agent and node\n",
        "chatbot_agent = create_agent(\n",
        "    llm,\n",
        "    tools,\n",
        "    system_message=\"You are helpful HR Chabot Agent.\",\n",
        ")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "49RMRx8TvJyU"
      },
      "source": [
        "## Node Definition"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 19,
      "metadata": {
        "id": "uCzNeu7tTMei"
      },
      "outputs": [],
      "source": [
        "import functools\n",
        "\n",
        "from langchain_core.messages import AIMessage\n",
        "\n",
        "\n",
        "# Helper function to create a node for a given agent\n",
        "def agent_node(state, agent, name):\n",
        "    result = agent.invoke(state)\n",
        "    # We convert the agent output into a format that is suitable to append to the global state\n",
        "    if isinstance(result, ToolMessage):\n",
        "        pass\n",
        "    else:\n",
        "        result = AIMessage(**result.dict(exclude={\"type\", \"name\"}), name=name)\n",
        "    return {\n",
        "        \"messages\": [result],\n",
        "        # Since we have a strict workflow, we can\n",
        "        # track the sender so we know who to pass to next.\n",
        "        \"sender\": name,\n",
        "    }"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 20,
      "metadata": {
        "id": "sf5ZJDLzTQEj"
      },
      "outputs": [],
      "source": [
        "from langgraph.prebuilt import ToolNode\n",
        "\n",
        "chatbot_node = functools.partial(agent_node, agent=chatbot_agent, name=\"HR Chatbot\")\n",
        "tool_node = ToolNode(tools, name=\"tools\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "k_sdjALsG3lC"
      },
      "source": [
        "## State Definition"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 21,
      "metadata": {
        "id": "6IFs8Aj4QiZA"
      },
      "outputs": [],
      "source": [
        "import operator\n",
        "from collections.abc import Sequence\n",
        "from typing import Annotated, TypedDict\n",
        "\n",
        "from langchain_core.messages import BaseMessage\n",
        "\n",
        "\n",
        "class AgentState(TypedDict):\n",
        "    messages: Annotated[Sequence[BaseMessage], operator.add]\n",
        "    sender: str"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "96ORXFv6vPy6"
      },
      "source": [
        "## Agentic Workflow Definition"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 22,
      "metadata": {
        "id": "gmeqXqxWINTS"
      },
      "outputs": [],
      "source": [
        "from langgraph.graph import END, StateGraph\n",
        "from langgraph.prebuilt import tools_condition\n",
        "\n",
        "workflow = StateGraph(AgentState)\n",
        "\n",
        "workflow.add_node(\"chatbot\", chatbot_node)\n",
        "workflow.add_node(\"tools\", tool_node)\n",
        "\n",
        "workflow.set_entry_point(\"chatbot\")\n",
        "workflow.add_conditional_edges(\"chatbot\", tools_condition, {\"tools\": \"tools\", END: END})\n",
        "\n",
        "workflow.add_edge(\"tools\", \"chatbot\")"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "R6-IUZHVvTy-"
      },
      "source": [
        "## Graph Compiliation and visualisation"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 23,
      "metadata": {
        "id": "NCydyyJxaBKX"
      },
      "outputs": [],
      "source": [
        "graph = workflow.compile()"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 24,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 235
        },
        "id": "x3zcF34dUf_V",
        "outputId": "5ba1d3c0-6baf-4074-e888-c9b45a9c943b"
      },
      "outputs": [
        {
          "data": {
            "image/jpeg": "/9j/4AAQSkZJRgABAQAAAQABAAD/4gHYSUNDX1BST0ZJTEUAAQEAAAHIAAAAAAQwAABtbnRyUkdCIFhZWiAH4AABAAEAAAAAAABhY3NwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAA9tYAAQAAAADTLQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAlkZXNjAAAA8AAAACRyWFlaAAABFAAAABRnWFlaAAABKAAAABRiWFlaAAABPAAAABR3dHB0AAABUAAAABRyVFJ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5QOp1vrUo414Df804g5BGs8WQj4w4e3C2tTeRSWDIVJaKGVOa5QpQ5uhO9FR7t1f8ASpYrRYtJkmmt19ufD+jnSyXubmHETg6I+EZHj0ewtTmp3xhanGI8QmEW0oDmuVSeYaSoeienXZ1XRdY1xt0W8W+TBnR2pkKS2pl+O+gLQ6hQ0pKknoQQSCDUJHk/8MwQRgGOAjuItjP/AK1FyUtuRCc4VLXyt897fHzJ/Wizn+CVz/5X+orQRuA3DeHIafYwTHWX2lBbbiLYyFJUDsEHl6EGt/nP8Ern/wAr/UVsaJbvNO3MvUzQUcaGq969fiXLSlK7h9GFKUoCL3PhvYbnJckiM7BkuHa3bfIcjlZ3slQQQFHfrIJrA+SiB4vevbfuqb0q9V6i/UWKrOOSkyEfJRA8XvXtv3U+SiB4vevbfuqb0rOPU4+hLGqczIczwqsYUDKXcLkkEHs5c5xTZ19KAQk/mIIqVxIjECM3HjMtx47SQlDTSAlCAO4ADoBXupVcqk55SZXKUpfidxSlKrIilKUApSlARzJcGg5PPjTX5M2LJjtKZSuG/wBntKiCQeh31SK1nyVQfGL37b91TalWYkrJfwiuVOEneUU/kQn5KoPjF79t+6nyVQfGL37b91TalMR+XREcGlyLoiE/JVB8Yvftv3U+SqD4xe/bfuqbUpiPy6IYNLkXREJ+SqD4xe/bfup8lUHxi9+2/dU2pTEfl0QwaXIuiIT8lUHxi9+2/dXrkcIbXLaU1Iud4fZV85tczaVD6D0qdUrKqyTuvRGVRpJ3UV0QpSlVFp//2Q==",
            "text/plain": [
              "<IPython.core.display.Image object>"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        }
      ],
      "source": [
        "from IPython.display import Image, display\n",
        "\n",
        "try:\n",
        "    display(Image(graph.get_graph(xray=True).draw_mermaid_png()))\n",
        "except Exception:\n",
        "    # This requires some extra dependencies and is optional\n",
        "    pass"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "Qm8VU-j0vYoY"
      },
      "source": [
        "## Process and View Response"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 25,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/"
        },
        "id": "Y1gVYfPtUiiq",
        "outputId": "0a1ceb0d-f518-4715-b42b-d0bee192ca87"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "Event:\n",
            "{'chatbot': {'messages': [AIMessage(content=[{'text': \"Okay, let's try to build a team for making an iOS app and identify any talent gaps using the available tool.\", 'type': 'text'}, {'id': 'toolu_0147LfjatFSoWVRFMHvvM6hV', 'input': {'query': 'iOS developer'}, 'name': 'lookup_employees', 'type': 'tool_use'}], response_metadata={'id': 'msg_01RSojaNUypEmcN7YYS5WxsL', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'tool_use', 'stop_sequence': None, 'usage': {'input_tokens': 381, 'output_tokens': 79}}, name='HR Chatbot', id='run-6ef23f8f-9777-4e58-a13b-16c3fddd6ffb-0', tool_calls=[{'name': 'lookup_employees', 'args': {'query': 'iOS developer'}, 'id': 'toolu_0147LfjatFSoWVRFMHvvM6hV'}], usage_metadata={'input_tokens': 381, 'output_tokens': 79, 'total_tokens': 460})],\n",
            "             'sender': 'HR Chatbot'}}\n",
            "---\n",
            "Event:\n",
            "{'tools': {'messages': [ToolMessage(content=\"[(Document(metadata={'_id': {'$oid': '66869852751d346e9874bba3'}, 'employee_id': 'E123457', 'first_name': 'Jane', 'last_name': 'Doe', 'gender': 'Male', 'date_of_birth': '1975-02-11', 'address': {'street': '776 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'jane.doe@example.com', 'phone_number': '+1-555-127-2693'}, 'job_details': {'job_title': 'Senior Software Engineer', 'department': 'IT', 'hire_date': '2012-05-09', 'employment_type': 'Full-Time', 'salary': 214290, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Berlin Office', 'is_remote': True}, 'reporting_manager': 'M987654', 'skills': ['AWS', 'Django', 'React', 'Python'], 'performance_reviews': [{'review_date': '2021-09-23', 'rating': 3.4, 'comments': 'Outstanding performance and dedication.'}, {'review_date': '2019-02-23', 'rating': 4.8, 'comments': 'Outstanding performance and dedication.'}], 'benefits': {'health_insurance': 'Silver Plan', 'retirement_plan': '401K', 'paid_time_off': 17}, 'emergency_contact': {'name': 'Emily Doe', 'relationship': 'Spouse', 'phone_number': '+1-555-983-7930'}, 'notes': 'Received Employee of the Month award in 2022.'}, page_content='Jane Doe, Male, born on 1975-02-11. Job: Senior Software Engineer in IT. Skills: AWS, Django, React, Python. Reviews: Rated 3.4 on 2021-09-23: Outstanding performance and dedication. Rated 4.8 on 2019-02-23: Outstanding performance and dedication.. Location: Works at Berlin Office, Remote: True. Notes: Received Employee of the Month award in 2022.'), 0.6741443872451782), (Document(metadata={'_id': {'$oid': '66869852751d346e9874bba9'}, 'employee_id': 'E123463', 'first_name': 'Chris', 'last_name': 'Lee', 'gender': 'Female', 'date_of_birth': '1960-06-25', 'address': {'street': '958 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'chris.lee@example.com', 'phone_number': '+1-555-558-5576'}, 'job_details': {'job_title': 'DevOps Engineer', 'department': 'Operations', 'hire_date': '2017-02-05', 'employment_type': 'Full-Time', 'salary': 165112, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Singapore Office', 'is_remote': True}, 'reporting_manager': 'M987660', 'skills': ['Flask', 'Docker', 'SQL', 'JavaScript'], 'performance_reviews': [{'review_date': '2020-09-15', 'rating': 3.9, 'comments': 'Outstanding performance and dedication.'}, {'review_date': '2021-03-06', 'rating': 4.5, 'comments': 'Consistently meets performance standards.'}], 'benefits': {'health_insurance': 'Bronze Plan', 'retirement_plan': '401K', 'paid_time_off': 30}, 'emergency_contact': {'name': 'Michael Doe', 'relationship': 'Parent', 'phone_number': '+1-555-204-7780'}, 'notes': 'Received Employee of the Month award in 2022.'}, page_content='Chris Lee, Female, born on 1960-06-25. Job: DevOps Engineer in Operations. Skills: Flask, Docker, SQL, JavaScript. Reviews: Rated 3.9 on 2020-09-15: Outstanding performance and dedication. Rated 4.5 on 2021-03-06: Consistently meets performance standards.. Location: Works at Singapore Office, Remote: True. Notes: Received Employee of the Month award in 2022.'), 0.6641373038291931), (Document(metadata={'_id': {'$oid': '66869852751d346e9874bba2'}, 'employee_id': 'E123456', 'first_name': 'John', 'last_name': 'Doe', 'gender': 'Male', 'date_of_birth': '1988-01-17', 'address': {'street': '637 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'john.doe@example.com', 'phone_number': '+1-555-272-7205'}, 'job_details': {'job_title': 'Software Engineer', 'department': 'IT', 'hire_date': '2006-05-17', 'employment_type': 'Full-Time', 'salary': 150040, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Paris Office', 'is_remote': False}, 'reporting_manager': 'M987654', 'skills': ['Flask', 'AWS', 'Kubernetes', 'JavaScript'], 'performance_reviews': [{'review_date': '2020-12-26', 'rating': 4.2, 'comments': 'Outstanding performance and dedication.'}, {'review_date': '2020-03-09', 'rating': 3.8, 'comments': 'Consistently meets performance standards.'}], 'benefits': {'health_insurance': 'Gold Plan', 'retirement_plan': '401K', 'paid_time_off': 22}, 'emergency_contact': {'name': 'Jane Smith', 'relationship': 'Spouse', 'phone_number': '+1-555-112-8267'}, 'notes': 'Completed leadership training in 2021.'}, page_content='John Doe, Male, born on 1988-01-17. Job: Software Engineer in IT. Skills: Flask, AWS, Kubernetes, JavaScript. Reviews: Rated 4.2 on 2020-12-26: Outstanding performance and dedication. Rated 3.8 on 2020-03-09: Consistently meets performance standards.. Location: Works at Paris Office, Remote: False. Notes: Completed leadership training in 2021.'), 0.663453996181488), (Document(metadata={'_id': {'$oid': '66869852751d346e9874bba8'}, 'employee_id': 'E123462', 'first_name': 'David', 'last_name': 'Wilson', 'gender': 'Male', 'date_of_birth': '1959-11-27', 'address': {'street': '733 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'david.wilson@example.com', 'phone_number': '+1-555-241-5326'}, 'job_details': {'job_title': 'QA Engineer', 'department': 'Quality Assurance', 'hire_date': '2007-09-21', 'employment_type': 'Full-Time', 'salary': 157693, 'currency': 'USD'}, 'work_location': {'nearest_office': 'New York Office', 'is_remote': True}, 'reporting_manager': 'M987659', 'skills': ['Node.js', 'Flask', 'React', 'Django'], 'performance_reviews': [{'review_date': '2023-04-16', 'rating': 3.1, 'comments': 'Consistently meets performance standards.'}, {'review_date': '2021-04-14', 'rating': 4.7, 'comments': 'Exceeded expectations in the last project.'}], 'benefits': {'health_insurance': 'Silver Plan', 'retirement_plan': '401K', 'paid_time_off': 19}, 'emergency_contact': {'name': 'Robert Johnson', 'relationship': 'Spouse', 'phone_number': '+1-555-773-9005'}, 'notes': 'Received Employee of the Month award in 2022.'}, page_content='David Wilson, Male, born on 1959-11-27. Job: QA Engineer in Quality Assurance. Skills: Node.js, Flask, React, Django. Reviews: Rated 3.1 on 2023-04-16: Consistently meets performance standards. Rated 4.7 on 2021-04-14: Exceeded expectations in the last project.. Location: Works at New York Office, Remote: True. Notes: Received Employee of the Month award in 2022.'), 0.6592249274253845), (Document(metadata={'_id': {'$oid': '66869852751d346e9874bba5'}, 'employee_id': 'E123459', 'first_name': 'Michael', 'last_name': 'Brown', 'gender': 'Female', 'date_of_birth': '1975-09-03', 'address': {'street': '887 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'michael.brown@example.com', 'phone_number': '+1-555-391-5648'}, 'job_details': {'job_title': 'Product Manager', 'department': 'Product', 'hire_date': '2000-06-02', 'employment_type': 'Full-Time', 'salary': 100877, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Sydney Office', 'is_remote': False}, 'reporting_manager': 'M987656', 'skills': ['Kubernetes', 'SQL', 'React', 'Python'], 'performance_reviews': [{'review_date': '2021-03-16', 'rating': 3.7, 'comments': 'Consistently meets performance standards.'}, {'review_date': '2019-03-07', 'rating': 3.7, 'comments': 'Exceeded expectations in the last project.'}], 'benefits': {'health_insurance': 'Gold Plan', 'retirement_plan': '401K', 'paid_time_off': 20}, 'emergency_contact': {'name': 'Emily Johnson', 'relationship': 'Sibling', 'phone_number': '+1-555-495-9940'}, 'notes': 'Promoted to Senior Software Engineer in 2020.'}, page_content='Michael Brown, Female, born on 1975-09-03. Job: Product Manager in Product. Skills: Kubernetes, SQL, React, Python. Reviews: Rated 3.7 on 2021-03-16: Consistently meets performance standards. Rated 3.7 on 2019-03-07: Exceeded expectations in the last project.. Location: Works at Sydney Office, Remote: False. Notes: Promoted to Senior Software Engineer in 2020.'), 0.6550472974777222), (Document(metadata={'_id': {'$oid': '66869852751d346e9874bbaa'}, 'employee_id': 'E123464', 'first_name': 'Sophia', 'last_name': 'Garcia', 'gender': 'Male', 'date_of_birth': '1971-05-23', 'address': {'street': '517 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'sophia.garcia@example.com', 'phone_number': '+1-555-194-1655'}, 'job_details': {'job_title': 'CTO', 'department': 'Executive', 'hire_date': '2009-05-03', 'employment_type': 'Full-Time', 'salary': 144266, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Chicago Office', 'is_remote': True}, 'reporting_manager': None, 'skills': ['Django', 'SQL', 'JavaScript', 'React'], 'performance_reviews': [{'review_date': '2023-11-25', 'rating': 4.2, 'comments': 'Outstanding performance and dedication.'}, {'review_date': '2021-06-06', 'rating': 3.8, 'comments': 'Outstanding performance and dedication.'}], 'benefits': {'health_insurance': 'Gold Plan', 'retirement_plan': '401K', 'paid_time_off': 18}, 'emergency_contact': {'name': 'Robert Johnson', 'relationship': 'Sibling', 'phone_number': '+1-555-889-5436'}, 'notes': 'Completed leadership training in 2021.'}, page_content='Sophia Garcia, Male, born on 1971-05-23. Job: CTO in Executive. Skills: Django, SQL, JavaScript, React. Reviews: Rated 4.2 on 2023-11-25: Outstanding performance and dedication. Rated 3.8 on 2021-06-06: Outstanding performance and dedication.. Location: Works at Chicago Office, Remote: True. Notes: Completed leadership training in 2021.'), 0.6511964797973633), (Document(metadata={'_id': {'$oid': '66869852751d346e9874bba6'}, 'employee_id': 'E123460', 'first_name': 'Sarah', 'last_name': 'Davis', 'gender': 'Female', 'date_of_birth': '1999-02-08', 'address': {'street': '468 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'sarah.davis@example.com', 'phone_number': '+1-555-835-2280'}, 'job_details': {'job_title': 'Project Manager', 'department': 'Project Management', 'hire_date': '2005-01-06', 'employment_type': 'Full-Time', 'salary': 168358, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Toronto Office', 'is_remote': False}, 'reporting_manager': 'M987657', 'skills': ['AWS', 'Kubernetes', 'Node.js', 'SQL'], 'performance_reviews': [{'review_date': '2022-06-01', 'rating': 3.1, 'comments': 'Exceeded expectations in the last project.'}, {'review_date': '2021-07-18', 'rating': 3.8, 'comments': 'Needs improvement in time management.'}], 'benefits': {'health_insurance': 'Silver Plan', 'retirement_plan': '401K', 'paid_time_off': 21}, 'emergency_contact': {'name': 'Emily Doe', 'relationship': 'Friend', 'phone_number': '+1-555-274-3508'}, 'notes': 'Completed leadership training in 2021.'}, page_content='Sarah Davis, Female, born on 1999-02-08. Job: Project Manager in Project Management. Skills: AWS, Kubernetes, Node.js, SQL. Reviews: Rated 3.1 on 2022-06-01: Exceeded expectations in the last project. Rated 3.8 on 2021-07-18: Needs improvement in time management.. Location: Works at Toronto Office, Remote: False. Notes: Completed leadership training in 2021.'), 0.6394219994544983), (Document(metadata={'_id': {'$oid': '66869852751d346e9874bba4'}, 'employee_id': 'E123458', 'first_name': 'Emily', 'last_name': 'Smith', 'gender': 'Male', 'date_of_birth': '1996-04-26', 'address': {'street': '613 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'emily.smith@example.com', 'phone_number': '+1-555-807-1477'}, 'job_details': {'job_title': 'Data Scientist', 'department': 'Data Science', 'hire_date': '2013-02-05', 'employment_type': 'Full-Time', 'salary': 249844, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Paris Office', 'is_remote': False}, 'reporting_manager': 'M987655', 'skills': ['Flask', 'AWS', 'Kubernetes', 'Python'], 'performance_reviews': [{'review_date': '2021-08-27', 'rating': 4.3, 'comments': 'Consistently meets performance standards.'}, {'review_date': '2022-11-01', 'rating': 3.3, 'comments': 'Outstanding performance and dedication.'}], 'benefits': {'health_insurance': 'Gold Plan', 'retirement_plan': '401K', 'paid_time_off': 27}, 'emergency_contact': {'name': 'Robert Smith', 'relationship': 'Sibling', 'phone_number': '+1-555-935-5927'}, 'notes': 'Promoted to Senior Software Engineer in 2020.'}, page_content='Emily Smith, Male, born on 1996-04-26. Job: Data Scientist in Data Science. Skills: Flask, AWS, Kubernetes, Python. Reviews: Rated 4.3 on 2021-08-27: Consistently meets performance standards. Rated 3.3 on 2022-11-01: Outstanding performance and dedication.. Location: Works at Paris Office, Remote: False. Notes: Promoted to Senior Software Engineer in 2020.'), 0.6281063556671143), (Document(metadata={'_id': {'$oid': '66869852751d346e9874bbab'}, 'employee_id': 'E123465', 'first_name': 'Olivia', 'last_name': 'Martinez', 'gender': 'Male', 'date_of_birth': '1998-01-20', 'address': {'street': '365 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'olivia.martinez@example.com', 'phone_number': '+1-555-782-9169'}, 'job_details': {'job_title': 'CEO', 'department': 'Executive', 'hire_date': '2016-10-24', 'employment_type': 'Full-Time', 'salary': 116724, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Berlin Office', 'is_remote': False}, 'reporting_manager': None, 'skills': ['AWS', 'Python', 'React', 'Kubernetes'], 'performance_reviews': [{'review_date': '2022-08-03', 'rating': 4.8, 'comments': 'Outstanding performance and dedication.'}, {'review_date': '2019-07-10', 'rating': 3.4, 'comments': 'Exceeded expectations in the last project.'}], 'benefits': {'health_insurance': 'Silver Plan', 'retirement_plan': '401K', 'paid_time_off': 22}, 'emergency_contact': {'name': 'Michael Smith', 'relationship': 'Spouse', 'phone_number': '+1-555-265-8828'}, 'notes': 'Received Employee of the Month award in 2022.'}, page_content='Olivia Martinez, Male, born on 1998-01-20. Job: CEO in Executive. Skills: AWS, Python, React, Kubernetes. Reviews: Rated 4.8 on 2022-08-03: Outstanding performance and dedication. Rated 3.4 on 2019-07-10: Exceeded expectations in the last project.. Location: Works at Berlin Office, Remote: False. Notes: Received Employee of the Month award in 2022.'), 0.6254255175590515), (Document(metadata={'_id': {'$oid': '66869852751d346e9874bba7'}, 'employee_id': 'E123461', 'first_name': 'Robert', 'last_name': 'Johnson', 'gender': 'Male', 'date_of_birth': '1953-06-04', 'address': {'street': '631 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'robert.johnson@example.com', 'phone_number': '+1-555-339-6801'}, 'job_details': {'job_title': 'UX Designer', 'department': 'Design', 'hire_date': '2009-01-13', 'employment_type': 'Full-Time', 'salary': 140608, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Tokyo Office', 'is_remote': True}, 'reporting_manager': 'M987658', 'skills': ['Django', 'Docker', 'Node.js', 'Python'], 'performance_reviews': [{'review_date': '2021-11-05', 'rating': 3.9, 'comments': 'Needs improvement in time management.'}, {'review_date': '2021-04-13', 'rating': 4.0, 'comments': 'Needs improvement in time management.'}], 'benefits': {'health_insurance': 'Bronze Plan', 'retirement_plan': '401K', 'paid_time_off': 17}, 'emergency_contact': {'name': 'Jane Johnson', 'relationship': 'Sibling', 'phone_number': '+1-555-589-8955'}, 'notes': 'Completed leadership training in 2021.'}, page_content='Robert Johnson, Male, born on 1953-06-04. Job: UX Designer in Design. Skills: Django, Docker, Node.js, Python. Reviews: Rated 3.9 on 2021-11-05: Needs improvement in time management. Rated 4.0 on 2021-04-13: Needs improvement in time management.. Location: Works at Tokyo Office, Remote: True. Notes: Completed leadership training in 2021.'), 0.6193082332611084)]\", name='lookup_employees', tool_call_id='toolu_0147LfjatFSoWVRFMHvvM6hV')]}}\n",
            "---\n",
            "Event:\n",
            "{'chatbot': {'messages': [AIMessage(content='Based on the employee lookup, we have:\\n\\niOS Developers: \\n- Jane Doe (Senior Software Engineer with React skills)\\n\\nOther Relevant Roles:\\n- Chris Lee (DevOps Engineer)\\n- John Doe (Software Engineer with JavaScript skills) \\n- David Wilson (QA Engineer)\\n- Sophia Garcia (CTO with React skills)\\n- Olivia Martinez (CEO with React skills)\\n\\nTalent Gaps:\\n- We only have 1 employee with direct iOS development experience (Jane Doe)\\n- To build a full iOS app team, we likely need:\\n    - Additional iOS developers \\n    - UI/UX designers for iOS\\n    - iOS QA/testers\\n    - Project manager experienced in iOS app development\\n- We may also need additional skills like Swift, Objective-C, XCode, iOS frameworks/libraries etc.\\n\\nSo in summary, while we have some relevant engineering talent, we have a significant talent gap in dedicated iOS app development skills and roles to build a full team for this project.', response_metadata={'id': 'msg_01BHsWWgNMP3M4DbrX2CUts9', 'model': 'claude-3-sonnet-20240229', 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 6299, 'output_tokens': 227}}, name='HR Chatbot', id='run-bb4d1f49-dc9a-4651-8832-6b56b558c74a-0', usage_metadata={'input_tokens': 6299, 'output_tokens': 227, 'total_tokens': 6526})],\n",
            "             'sender': 'HR Chatbot'}}\n",
            "---\n",
            "\n",
            "Final state of temp_mem:\n",
            "Type: AIMessage\n",
            "Content: [{'text': \"Okay, let's try to build a team for making an iOS app and identify any talent gaps using the available tool.\", 'type': 'text'}, {'id': 'toolu_01VM4RC2VtHtNezVfKgvxQ6g', 'input': {'query': 'iOS developer'}, 'name': 'lookup_employees', 'type': 'tool_use'}]\n",
            "---\n",
            "Type: ToolMessage\n",
            "Content: [(Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e5f'}, 'employee_id': 'E123457', 'first_name': 'Jane', 'last_name': 'Doe', 'gender': 'Male', 'date_of_birth': '1978-06-06', 'address': {'street': '195 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'jane.doe@example.com', 'phone_number': '+1-555-717-6138'}, 'job_details': {'job_title': 'Senior Software Engineer', 'department': 'IT', 'hire_date': '2018-04-18', 'employment_type': 'Full-Time', 'salary': 225281, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Berlin Office', 'is_remote': False}, 'reporting_manager': 'M987654', 'skills': ['Flask', 'Node.js', 'AWS', 'SQL'], 'performance_reviews': [{'review_date': '2021-06-05', 'rating': 4.5, 'comments': 'Exceeded expectations in the last project.'}, {'review_date': '2020-10-24', 'rating': 4.6, 'comments': 'Needs improvement in time management.'}], 'benefits': {'health_insurance': 'Silver Plan', 'retirement_plan': '401K', 'paid_time_off': 25}, 'emergency_contact': {'name': 'Robert Smith', 'relationship': 'Friend', 'phone_number': '+1-555-869-8838'}, 'notes': 'Received Employee of the Month award in 2022.'}, page_content='Jane Doe, Male, born on 1978-06-06. Job: Senior Software Engineer in IT. Skills: Flask, Node.js, AWS, SQL. Reviews: Rated 4.5 on 2021-06-05: Exceeded expectations in the last project. Rated 4.6 on 2020-10-24: Needs improvement in time management.. Location: Works at Berlin Office, Remote: False. Notes: Received Employee of the Month award in 2022.'), 0.680349588394165), (Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e5e'}, 'employee_id': 'E123456', 'first_name': 'John', 'last_name': 'Doe', 'gender': 'Female', 'date_of_birth': '1958-03-20', 'address': {'street': '836 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'john.doe@example.com', 'phone_number': '+1-555-184-7441'}, 'job_details': {'job_title': 'Software Engineer', 'department': 'IT', 'hire_date': '2003-02-14', 'employment_type': 'Full-Time', 'salary': 122943, 'currency': 'USD'}, 'work_location': {'nearest_office': 'London Office', 'is_remote': True}, 'reporting_manager': 'M987654', 'skills': ['Kubernetes', 'Django', 'React', 'Docker'], 'performance_reviews': [{'review_date': '2020-11-26', 'rating': 3.8, 'comments': 'Outstanding performance and dedication.'}, {'review_date': '2022-03-09', 'rating': 3.5, 'comments': 'Consistently meets performance standards.'}], 'benefits': {'health_insurance': 'Silver Plan', 'retirement_plan': '401K', 'paid_time_off': 15}, 'emergency_contact': {'name': 'Emily Johnson', 'relationship': 'Spouse', 'phone_number': '+1-555-228-6887'}, 'notes': 'Received Employee of the Month award in 2022.'}, page_content='John Doe, Female, born on 1958-03-20. Job: Software Engineer in IT. Skills: Kubernetes, Django, React, Docker. Reviews: Rated 3.8 on 2020-11-26: Outstanding performance and dedication. Rated 3.5 on 2022-03-09: Consistently meets performance standards.. Location: Works at London Office, Remote: True. Notes: Received Employee of the Month award in 2022.'), 0.6688884496688843), (Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e64'}, 'employee_id': 'E123462', 'first_name': 'David', 'last_name': 'Wilson', 'gender': 'Female', 'date_of_birth': '1973-02-08', 'address': {'street': '560 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'david.wilson@example.com', 'phone_number': '+1-555-939-5130'}, 'job_details': {'job_title': 'QA Engineer', 'department': 'Quality Assurance', 'hire_date': '2011-06-22', 'employment_type': 'Full-Time', 'salary': 73851, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Tokyo Office', 'is_remote': True}, 'reporting_manager': 'M987659', 'skills': ['Node.js', 'Django', 'JavaScript', 'React'], 'performance_reviews': [{'review_date': '2020-01-27', 'rating': 3.3, 'comments': 'Needs improvement in time management.'}, {'review_date': '2022-11-07', 'rating': 3.1, 'comments': 'Exceeded expectations in the last project.'}], 'benefits': {'health_insurance': 'Silver Plan', 'retirement_plan': '401K', 'paid_time_off': 18}, 'emergency_contact': {'name': 'Robert Smith', 'relationship': 'Sibling', 'phone_number': '+1-555-472-5486'}, 'notes': 'Promoted to Senior Software Engineer in 2020.'}, page_content='David Wilson, Female, born on 1973-02-08. Job: QA Engineer in Quality Assurance. Skills: Node.js, Django, JavaScript, React. Reviews: Rated 3.3 on 2020-01-27: Needs improvement in time management. Rated 3.1 on 2022-11-07: Exceeded expectations in the last project.. Location: Works at Tokyo Office, Remote: True. Notes: Promoted to Senior Software Engineer in 2020.'), 0.6652591228485107), (Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e62'}, 'employee_id': 'E123460', 'first_name': 'Sarah', 'last_name': 'Davis', 'gender': 'Female', 'date_of_birth': '1996-02-06', 'address': {'street': '546 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'sarah.davis@example.com', 'phone_number': '+1-555-385-7456'}, 'job_details': {'job_title': 'Project Manager', 'department': 'Project Management', 'hire_date': '2016-12-04', 'employment_type': 'Full-Time', 'salary': 239517, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Toronto Office', 'is_remote': True}, 'reporting_manager': 'M987657', 'skills': ['Python', 'Flask', 'Node.js', 'Django'], 'performance_reviews': [{'review_date': '2021-06-04', 'rating': 3.8, 'comments': 'Consistently meets performance standards.'}, {'review_date': '2020-02-14', 'rating': 4.0, 'comments': 'Consistently meets performance standards.'}], 'benefits': {'health_insurance': 'Silver Plan', 'retirement_plan': '401K', 'paid_time_off': 26}, 'emergency_contact': {'name': 'Emily Johnson', 'relationship': 'Parent', 'phone_number': '+1-555-318-5848'}, 'notes': 'Promoted to Senior Software Engineer in 2020.'}, page_content='Sarah Davis, Female, born on 1996-02-06. Job: Project Manager in Project Management. Skills: Python, Flask, Node.js, Django. Reviews: Rated 3.8 on 2021-06-04: Consistently meets performance standards. Rated 4.0 on 2020-02-14: Consistently meets performance standards.. Location: Works at Toronto Office, Remote: True. Notes: Promoted to Senior Software Engineer in 2020.'), 0.664700984954834), (Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e65'}, 'employee_id': 'E123463', 'first_name': 'Chris', 'last_name': 'Lee', 'gender': 'Female', 'date_of_birth': '1996-05-20', 'address': {'street': '645 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'chris.lee@example.com', 'phone_number': '+1-555-116-4321'}, 'job_details': {'job_title': 'DevOps Engineer', 'department': 'Operations', 'hire_date': '2014-03-14', 'employment_type': 'Full-Time', 'salary': 142711, 'currency': 'USD'}, 'work_location': {'nearest_office': 'New York Office', 'is_remote': True}, 'reporting_manager': 'M987660', 'skills': ['Python', 'React', 'Node.js', 'AWS'], 'performance_reviews': [{'review_date': '2021-08-27', 'rating': 3.2, 'comments': 'Outstanding performance and dedication.'}, {'review_date': '2021-06-27', 'rating': 4.4, 'comments': 'Needs improvement in time management.'}], 'benefits': {'health_insurance': 'Bronze Plan', 'retirement_plan': '401K', 'paid_time_off': 18}, 'emergency_contact': {'name': 'Emily Johnson', 'relationship': 'Spouse', 'phone_number': '+1-555-620-1866'}, 'notes': 'Actively involved in company hackathons and innovation challenges.'}, page_content='Chris Lee, Female, born on 1996-05-20. Job: DevOps Engineer in Operations. Skills: Python, React, Node.js, AWS. Reviews: Rated 3.2 on 2021-08-27: Outstanding performance and dedication. Rated 4.4 on 2021-06-27: Needs improvement in time management.. Location: Works at New York Office, Remote: True. Notes: Actively involved in company hackathons and innovation challenges.'), 0.6634999513626099), (Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e66'}, 'employee_id': 'E123464', 'first_name': 'Sophia', 'last_name': 'Garcia', 'gender': 'Female', 'date_of_birth': '1962-06-25', 'address': {'street': '357 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'sophia.garcia@example.com', 'phone_number': '+1-555-281-7873'}, 'job_details': {'job_title': 'CTO', 'department': 'Executive', 'hire_date': '2014-01-14', 'employment_type': 'Full-Time', 'salary': 223012, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Tokyo Office', 'is_remote': True}, 'reporting_manager': None, 'skills': ['Flask', 'Kubernetes', 'Node.js', 'Django'], 'performance_reviews': [{'review_date': '2021-04-12', 'rating': 3.9, 'comments': 'Exceeded expectations in the last project.'}, {'review_date': '2020-11-01', 'rating': 4.3, 'comments': 'Consistently meets performance standards.'}], 'benefits': {'health_insurance': 'Bronze Plan', 'retirement_plan': '401K', 'paid_time_off': 27}, 'emergency_contact': {'name': 'Jane Johnson', 'relationship': 'Parent', 'phone_number': '+1-555-316-4315'}, 'notes': 'Completed leadership training in 2021.'}, page_content='Sophia Garcia, Female, born on 1962-06-25. Job: CTO in Executive. Skills: Flask, Kubernetes, Node.js, Django. Reviews: Rated 3.9 on 2021-04-12: Exceeded expectations in the last project. Rated 4.3 on 2020-11-01: Consistently meets performance standards.. Location: Works at Tokyo Office, Remote: True. Notes: Completed leadership training in 2021.'), 0.6574955582618713), (Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e60'}, 'employee_id': 'E123458', 'first_name': 'Emily', 'last_name': 'Smith', 'gender': 'Female', 'date_of_birth': '1968-11-18', 'address': {'street': '542 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'emily.smith@example.com', 'phone_number': '+1-555-792-3408'}, 'job_details': {'job_title': 'Data Scientist', 'department': 'Data Science', 'hire_date': '2019-01-12', 'employment_type': 'Full-Time', 'salary': 161413, 'currency': 'USD'}, 'work_location': {'nearest_office': 'London Office', 'is_remote': True}, 'reporting_manager': 'M987655', 'skills': ['SQL', 'Node.js', 'Kubernetes', 'Python'], 'performance_reviews': [{'review_date': '2021-07-14', 'rating': 3.6, 'comments': 'Exceeded expectations in the last project.'}, {'review_date': '2021-07-25', 'rating': 4.2, 'comments': 'Consistently meets performance standards.'}], 'benefits': {'health_insurance': 'Bronze Plan', 'retirement_plan': '401K', 'paid_time_off': 21}, 'emergency_contact': {'name': 'Emily Doe', 'relationship': 'Friend', 'phone_number': '+1-555-126-5678'}, 'notes': 'Actively involved in company hackathons and innovation challenges.'}, page_content='Emily Smith, Female, born on 1968-11-18. Job: Data Scientist in Data Science. Skills: SQL, Node.js, Kubernetes, Python. Reviews: Rated 3.6 on 2021-07-14: Exceeded expectations in the last project. Rated 4.2 on 2021-07-25: Consistently meets performance standards.. Location: Works at London Office, Remote: True. Notes: Actively involved in company hackathons and innovation challenges.'), 0.6559557914733887), (Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e61'}, 'employee_id': 'E123459', 'first_name': 'Michael', 'last_name': 'Brown', 'gender': 'Female', 'date_of_birth': '1967-02-08', 'address': {'street': '379 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'michael.brown@example.com', 'phone_number': '+1-555-283-4175'}, 'job_details': {'job_title': 'Product Manager', 'department': 'Product', 'hire_date': '2017-03-11', 'employment_type': 'Full-Time', 'salary': 202879, 'currency': 'USD'}, 'work_location': {'nearest_office': 'London Office', 'is_remote': True}, 'reporting_manager': 'M987656', 'skills': ['Django', 'Kubernetes', 'Node.js', 'SQL'], 'performance_reviews': [{'review_date': '2022-09-16', 'rating': 3.4, 'comments': 'Outstanding performance and dedication.'}, {'review_date': '2022-06-22', 'rating': 3.7, 'comments': 'Outstanding performance and dedication.'}], 'benefits': {'health_insurance': 'Silver Plan', 'retirement_plan': '401K', 'paid_time_off': 21}, 'emergency_contact': {'name': 'Robert Johnson', 'relationship': 'Parent', 'phone_number': '+1-555-712-6007'}, 'notes': 'Promoted to Senior Software Engineer in 2020.'}, page_content='Michael Brown, Female, born on 1967-02-08. Job: Product Manager in Product. Skills: Django, Kubernetes, Node.js, SQL. Reviews: Rated 3.4 on 2022-09-16: Outstanding performance and dedication. Rated 3.7 on 2022-06-22: Outstanding performance and dedication.. Location: Works at London Office, Remote: True. Notes: Promoted to Senior Software Engineer in 2020.'), 0.6536825895309448), (Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e63'}, 'employee_id': 'E123461', 'first_name': 'Robert', 'last_name': 'Johnson', 'gender': 'Male', 'date_of_birth': '1983-08-09', 'address': {'street': '792 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'robert.johnson@example.com', 'phone_number': '+1-555-901-3728'}, 'job_details': {'job_title': 'UX Designer', 'department': 'Design', 'hire_date': '2002-01-28', 'employment_type': 'Full-Time', 'salary': 171689, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Toronto Office', 'is_remote': False}, 'reporting_manager': 'M987658', 'skills': ['AWS', 'Flask', 'Kubernetes', 'SQL'], 'performance_reviews': [{'review_date': '2021-09-01', 'rating': 4.1, 'comments': 'Needs improvement in time management.'}, {'review_date': '2022-09-08', 'rating': 3.6, 'comments': 'Outstanding performance and dedication.'}], 'benefits': {'health_insurance': 'Gold Plan', 'retirement_plan': '401K', 'paid_time_off': 22}, 'emergency_contact': {'name': 'Michael Doe', 'relationship': 'Friend', 'phone_number': '+1-555-634-2450'}, 'notes': 'Promoted to Senior Software Engineer in 2020.'}, page_content='Robert Johnson, Male, born on 1983-08-09. Job: UX Designer in Design. Skills: AWS, Flask, Kubernetes, SQL. Reviews: Rated 4.1 on 2021-09-01: Needs improvement in time management. Rated 3.6 on 2022-09-08: Outstanding performance and dedication.. Location: Works at Toronto Office, Remote: False. Notes: Promoted to Senior Software Engineer in 2020.'), 0.6349728107452393), (Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e67'}, 'employee_id': 'E123465', 'first_name': 'Olivia', 'last_name': 'Martinez', 'gender': 'Female', 'date_of_birth': '1971-11-05', 'address': {'street': '304 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'olivia.martinez@example.com', 'phone_number': '+1-555-634-7720'}, 'job_details': {'job_title': 'CEO', 'department': 'Executive', 'hire_date': '2017-12-03', 'employment_type': 'Full-Time', 'salary': 216271, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Tokyo Office', 'is_remote': False}, 'reporting_manager': None, 'skills': ['Kubernetes', 'Django', 'Python', 'JavaScript'], 'performance_reviews': [{'review_date': '2020-05-14', 'rating': 5.0, 'comments': 'Outstanding performance and dedication.'}, {'review_date': '2019-12-21', 'rating': 3.2, 'comments': 'Consistently meets performance standards.'}], 'benefits': {'health_insurance': 'Bronze Plan', 'retirement_plan': '401K', 'paid_time_off': 21}, 'emergency_contact': {'name': 'Emily Johnson', 'relationship': 'Sibling', 'phone_number': '+1-555-708-4999'}, 'notes': 'Actively involved in company hackathons and innovation challenges.'}, page_content='Olivia Martinez, Female, born on 1971-11-05. Job: CEO in Executive. Skills: Kubernetes, Django, Python, JavaScript. Reviews: Rated 5.0 on 2020-05-14: Outstanding performance and dedication. Rated 3.2 on 2019-12-21: Consistently meets performance standards.. Location: Works at Tokyo Office, Remote: False. Notes: Actively involved in company hackathons and innovation challenges.'), 0.623656153678894)]\n",
            "---\n",
            "Type: AIMessage\n",
            "Content: The search returned several employees with iOS development skills like Swift, Objective-C, etc. However, there are no employees listed with a primary role as an iOS developer.\n",
            "\n",
            "To build a strong iOS app development team, we would likely need to hire some dedicated iOS developers with extensive experience in iOS frameworks, UI/UX design for iOS, and publishing apps to the App Store.\n",
            "\n",
            "The current employees who could potentially contribute based on their listed skills:\n",
            "\n",
            "- Jane Doe (Senior Software Engineer) - Skills include Node.js which could be useful for backend/API work\n",
            "- John Doe (Software Engineer) - React skills could help with cross-platform UI components \n",
            "- David Wilson (QA Engineer) - Could help with testing the iOS app\n",
            "- Sarah Davis (Project Manager) - Project management skills for the app development\n",
            "\n",
            "So we have some supporting roles covered, but are lacking core iOS development talent. We would need to hire at least 1-2 dedicated iOS developers to properly build and launch a quality iOS app.\n",
            "---\n",
            "Type: AIMessage\n",
            "Content: [{'text': \"Okay, let's try to build a team for making an iOS app and identify any talent gaps using the available tool.\", 'type': 'text'}, {'id': 'toolu_01ELVTHTfxYhjrkKxNGY1Cb5', 'input': {'query': 'iOS developer'}, 'name': 'lookup_employees', 'type': 'tool_use'}]\n",
            "---\n",
            "Type: ToolMessage\n",
            "Content: [(Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e5f'}, 'employee_id': 'E123457', 'first_name': 'Jane', 'last_name': 'Doe', 'gender': 'Male', 'date_of_birth': '1978-06-06', 'address': {'street': '195 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'jane.doe@example.com', 'phone_number': '+1-555-717-6138'}, 'job_details': {'job_title': 'Senior Software Engineer', 'department': 'IT', 'hire_date': '2018-04-18', 'employment_type': 'Full-Time', 'salary': 225281, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Berlin Office', 'is_remote': False}, 'reporting_manager': 'M987654', 'skills': ['Flask', 'Node.js', 'AWS', 'SQL'], 'performance_reviews': [{'review_date': '2021-06-05', 'rating': 4.5, 'comments': 'Exceeded expectations in the last project.'}, {'review_date': '2020-10-24', 'rating': 4.6, 'comments': 'Needs improvement in time management.'}], 'benefits': {'health_insurance': 'Silver Plan', 'retirement_plan': '401K', 'paid_time_off': 25}, 'emergency_contact': {'name': 'Robert Smith', 'relationship': 'Friend', 'phone_number': '+1-555-869-8838'}, 'notes': 'Received Employee of the Month award in 2022.'}, page_content='Jane Doe, Male, born on 1978-06-06. Job: Senior Software Engineer in IT. Skills: Flask, Node.js, AWS, SQL. Reviews: Rated 4.5 on 2021-06-05: Exceeded expectations in the last project. Rated 4.6 on 2020-10-24: Needs improvement in time management.. Location: Works at Berlin Office, Remote: False. Notes: Received Employee of the Month award in 2022.'), 0.680349588394165), (Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e5e'}, 'employee_id': 'E123456', 'first_name': 'John', 'last_name': 'Doe', 'gender': 'Female', 'date_of_birth': '1958-03-20', 'address': {'street': '836 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'john.doe@example.com', 'phone_number': '+1-555-184-7441'}, 'job_details': {'job_title': 'Software Engineer', 'department': 'IT', 'hire_date': '2003-02-14', 'employment_type': 'Full-Time', 'salary': 122943, 'currency': 'USD'}, 'work_location': {'nearest_office': 'London Office', 'is_remote': True}, 'reporting_manager': 'M987654', 'skills': ['Kubernetes', 'Django', 'React', 'Docker'], 'performance_reviews': [{'review_date': '2020-11-26', 'rating': 3.8, 'comments': 'Outstanding performance and dedication.'}, {'review_date': '2022-03-09', 'rating': 3.5, 'comments': 'Consistently meets performance standards.'}], 'benefits': {'health_insurance': 'Silver Plan', 'retirement_plan': '401K', 'paid_time_off': 15}, 'emergency_contact': {'name': 'Emily Johnson', 'relationship': 'Spouse', 'phone_number': '+1-555-228-6887'}, 'notes': 'Received Employee of the Month award in 2022.'}, page_content='John Doe, Female, born on 1958-03-20. Job: Software Engineer in IT. Skills: Kubernetes, Django, React, Docker. Reviews: Rated 3.8 on 2020-11-26: Outstanding performance and dedication. Rated 3.5 on 2022-03-09: Consistently meets performance standards.. Location: Works at London Office, Remote: True. Notes: Received Employee of the Month award in 2022.'), 0.6688884496688843), (Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e64'}, 'employee_id': 'E123462', 'first_name': 'David', 'last_name': 'Wilson', 'gender': 'Female', 'date_of_birth': '1973-02-08', 'address': {'street': '560 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'david.wilson@example.com', 'phone_number': '+1-555-939-5130'}, 'job_details': {'job_title': 'QA Engineer', 'department': 'Quality Assurance', 'hire_date': '2011-06-22', 'employment_type': 'Full-Time', 'salary': 73851, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Tokyo Office', 'is_remote': True}, 'reporting_manager': 'M987659', 'skills': ['Node.js', 'Django', 'JavaScript', 'React'], 'performance_reviews': [{'review_date': '2020-01-27', 'rating': 3.3, 'comments': 'Needs improvement in time management.'}, {'review_date': '2022-11-07', 'rating': 3.1, 'comments': 'Exceeded expectations in the last project.'}], 'benefits': {'health_insurance': 'Silver Plan', 'retirement_plan': '401K', 'paid_time_off': 18}, 'emergency_contact': {'name': 'Robert Smith', 'relationship': 'Sibling', 'phone_number': '+1-555-472-5486'}, 'notes': 'Promoted to Senior Software Engineer in 2020.'}, page_content='David Wilson, Female, born on 1973-02-08. Job: QA Engineer in Quality Assurance. Skills: Node.js, Django, JavaScript, React. Reviews: Rated 3.3 on 2020-01-27: Needs improvement in time management. Rated 3.1 on 2022-11-07: Exceeded expectations in the last project.. Location: Works at Tokyo Office, Remote: True. Notes: Promoted to Senior Software Engineer in 2020.'), 0.6652591228485107), (Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e62'}, 'employee_id': 'E123460', 'first_name': 'Sarah', 'last_name': 'Davis', 'gender': 'Female', 'date_of_birth': '1996-02-06', 'address': {'street': '546 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'sarah.davis@example.com', 'phone_number': '+1-555-385-7456'}, 'job_details': {'job_title': 'Project Manager', 'department': 'Project Management', 'hire_date': '2016-12-04', 'employment_type': 'Full-Time', 'salary': 239517, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Toronto Office', 'is_remote': True}, 'reporting_manager': 'M987657', 'skills': ['Python', 'Flask', 'Node.js', 'Django'], 'performance_reviews': [{'review_date': '2021-06-04', 'rating': 3.8, 'comments': 'Consistently meets performance standards.'}, {'review_date': '2020-02-14', 'rating': 4.0, 'comments': 'Consistently meets performance standards.'}], 'benefits': {'health_insurance': 'Silver Plan', 'retirement_plan': '401K', 'paid_time_off': 26}, 'emergency_contact': {'name': 'Emily Johnson', 'relationship': 'Parent', 'phone_number': '+1-555-318-5848'}, 'notes': 'Promoted to Senior Software Engineer in 2020.'}, page_content='Sarah Davis, Female, born on 1996-02-06. Job: Project Manager in Project Management. Skills: Python, Flask, Node.js, Django. Reviews: Rated 3.8 on 2021-06-04: Consistently meets performance standards. Rated 4.0 on 2020-02-14: Consistently meets performance standards.. Location: Works at Toronto Office, Remote: True. Notes: Promoted to Senior Software Engineer in 2020.'), 0.664700984954834), (Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e65'}, 'employee_id': 'E123463', 'first_name': 'Chris', 'last_name': 'Lee', 'gender': 'Female', 'date_of_birth': '1996-05-20', 'address': {'street': '645 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'chris.lee@example.com', 'phone_number': '+1-555-116-4321'}, 'job_details': {'job_title': 'DevOps Engineer', 'department': 'Operations', 'hire_date': '2014-03-14', 'employment_type': 'Full-Time', 'salary': 142711, 'currency': 'USD'}, 'work_location': {'nearest_office': 'New York Office', 'is_remote': True}, 'reporting_manager': 'M987660', 'skills': ['Python', 'React', 'Node.js', 'AWS'], 'performance_reviews': [{'review_date': '2021-08-27', 'rating': 3.2, 'comments': 'Outstanding performance and dedication.'}, {'review_date': '2021-06-27', 'rating': 4.4, 'comments': 'Needs improvement in time management.'}], 'benefits': {'health_insurance': 'Bronze Plan', 'retirement_plan': '401K', 'paid_time_off': 18}, 'emergency_contact': {'name': 'Emily Johnson', 'relationship': 'Spouse', 'phone_number': '+1-555-620-1866'}, 'notes': 'Actively involved in company hackathons and innovation challenges.'}, page_content='Chris Lee, Female, born on 1996-05-20. Job: DevOps Engineer in Operations. Skills: Python, React, Node.js, AWS. Reviews: Rated 3.2 on 2021-08-27: Outstanding performance and dedication. Rated 4.4 on 2021-06-27: Needs improvement in time management.. Location: Works at New York Office, Remote: True. Notes: Actively involved in company hackathons and innovation challenges.'), 0.6634999513626099), (Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e66'}, 'employee_id': 'E123464', 'first_name': 'Sophia', 'last_name': 'Garcia', 'gender': 'Female', 'date_of_birth': '1962-06-25', 'address': {'street': '357 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'sophia.garcia@example.com', 'phone_number': '+1-555-281-7873'}, 'job_details': {'job_title': 'CTO', 'department': 'Executive', 'hire_date': '2014-01-14', 'employment_type': 'Full-Time', 'salary': 223012, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Tokyo Office', 'is_remote': True}, 'reporting_manager': None, 'skills': ['Flask', 'Kubernetes', 'Node.js', 'Django'], 'performance_reviews': [{'review_date': '2021-04-12', 'rating': 3.9, 'comments': 'Exceeded expectations in the last project.'}, {'review_date': '2020-11-01', 'rating': 4.3, 'comments': 'Consistently meets performance standards.'}], 'benefits': {'health_insurance': 'Bronze Plan', 'retirement_plan': '401K', 'paid_time_off': 27}, 'emergency_contact': {'name': 'Jane Johnson', 'relationship': 'Parent', 'phone_number': '+1-555-316-4315'}, 'notes': 'Completed leadership training in 2021.'}, page_content='Sophia Garcia, Female, born on 1962-06-25. Job: CTO in Executive. Skills: Flask, Kubernetes, Node.js, Django. Reviews: Rated 3.9 on 2021-04-12: Exceeded expectations in the last project. Rated 4.3 on 2020-11-01: Consistently meets performance standards.. Location: Works at Tokyo Office, Remote: True. Notes: Completed leadership training in 2021.'), 0.6574955582618713), (Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e60'}, 'employee_id': 'E123458', 'first_name': 'Emily', 'last_name': 'Smith', 'gender': 'Female', 'date_of_birth': '1968-11-18', 'address': {'street': '542 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'emily.smith@example.com', 'phone_number': '+1-555-792-3408'}, 'job_details': {'job_title': 'Data Scientist', 'department': 'Data Science', 'hire_date': '2019-01-12', 'employment_type': 'Full-Time', 'salary': 161413, 'currency': 'USD'}, 'work_location': {'nearest_office': 'London Office', 'is_remote': True}, 'reporting_manager': 'M987655', 'skills': ['SQL', 'Node.js', 'Kubernetes', 'Python'], 'performance_reviews': [{'review_date': '2021-07-14', 'rating': 3.6, 'comments': 'Exceeded expectations in the last project.'}, {'review_date': '2021-07-25', 'rating': 4.2, 'comments': 'Consistently meets performance standards.'}], 'benefits': {'health_insurance': 'Bronze Plan', 'retirement_plan': '401K', 'paid_time_off': 21}, 'emergency_contact': {'name': 'Emily Doe', 'relationship': 'Friend', 'phone_number': '+1-555-126-5678'}, 'notes': 'Actively involved in company hackathons and innovation challenges.'}, page_content='Emily Smith, Female, born on 1968-11-18. Job: Data Scientist in Data Science. Skills: SQL, Node.js, Kubernetes, Python. Reviews: Rated 3.6 on 2021-07-14: Exceeded expectations in the last project. Rated 4.2 on 2021-07-25: Consistently meets performance standards.. Location: Works at London Office, Remote: True. Notes: Actively involved in company hackathons and innovation challenges.'), 0.6559557914733887), (Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e61'}, 'employee_id': 'E123459', 'first_name': 'Michael', 'last_name': 'Brown', 'gender': 'Female', 'date_of_birth': '1967-02-08', 'address': {'street': '379 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'michael.brown@example.com', 'phone_number': '+1-555-283-4175'}, 'job_details': {'job_title': 'Product Manager', 'department': 'Product', 'hire_date': '2017-03-11', 'employment_type': 'Full-Time', 'salary': 202879, 'currency': 'USD'}, 'work_location': {'nearest_office': 'London Office', 'is_remote': True}, 'reporting_manager': 'M987656', 'skills': ['Django', 'Kubernetes', 'Node.js', 'SQL'], 'performance_reviews': [{'review_date': '2022-09-16', 'rating': 3.4, 'comments': 'Outstanding performance and dedication.'}, {'review_date': '2022-06-22', 'rating': 3.7, 'comments': 'Outstanding performance and dedication.'}], 'benefits': {'health_insurance': 'Silver Plan', 'retirement_plan': '401K', 'paid_time_off': 21}, 'emergency_contact': {'name': 'Robert Johnson', 'relationship': 'Parent', 'phone_number': '+1-555-712-6007'}, 'notes': 'Promoted to Senior Software Engineer in 2020.'}, page_content='Michael Brown, Female, born on 1967-02-08. Job: Product Manager in Product. Skills: Django, Kubernetes, Node.js, SQL. Reviews: Rated 3.4 on 2022-09-16: Outstanding performance and dedication. Rated 3.7 on 2022-06-22: Outstanding performance and dedication.. Location: Works at London Office, Remote: True. Notes: Promoted to Senior Software Engineer in 2020.'), 0.6536825895309448), (Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e63'}, 'employee_id': 'E123461', 'first_name': 'Robert', 'last_name': 'Johnson', 'gender': 'Male', 'date_of_birth': '1983-08-09', 'address': {'street': '792 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'robert.johnson@example.com', 'phone_number': '+1-555-901-3728'}, 'job_details': {'job_title': 'UX Designer', 'department': 'Design', 'hire_date': '2002-01-28', 'employment_type': 'Full-Time', 'salary': 171689, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Toronto Office', 'is_remote': False}, 'reporting_manager': 'M987658', 'skills': ['AWS', 'Flask', 'Kubernetes', 'SQL'], 'performance_reviews': [{'review_date': '2021-09-01', 'rating': 4.1, 'comments': 'Needs improvement in time management.'}, {'review_date': '2022-09-08', 'rating': 3.6, 'comments': 'Outstanding performance and dedication.'}], 'benefits': {'health_insurance': 'Gold Plan', 'retirement_plan': '401K', 'paid_time_off': 22}, 'emergency_contact': {'name': 'Michael Doe', 'relationship': 'Friend', 'phone_number': '+1-555-634-2450'}, 'notes': 'Promoted to Senior Software Engineer in 2020.'}, page_content='Robert Johnson, Male, born on 1983-08-09. Job: UX Designer in Design. Skills: AWS, Flask, Kubernetes, SQL. Reviews: Rated 4.1 on 2021-09-01: Needs improvement in time management. Rated 3.6 on 2022-09-08: Outstanding performance and dedication.. Location: Works at Toronto Office, Remote: False. Notes: Promoted to Senior Software Engineer in 2020.'), 0.6349728107452393), (Document(metadata={'_id': {'$oid': '66861d2fe88c843267c16e67'}, 'employee_id': 'E123465', 'first_name': 'Olivia', 'last_name': 'Martinez', 'gender': 'Female', 'date_of_birth': '1971-11-05', 'address': {'street': '304 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'olivia.martinez@example.com', 'phone_number': '+1-555-634-7720'}, 'job_details': {'job_title': 'CEO', 'department': 'Executive', 'hire_date': '2017-12-03', 'employment_type': 'Full-Time', 'salary': 216271, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Tokyo Office', 'is_remote': False}, 'reporting_manager': None, 'skills': ['Kubernetes', 'Django', 'Python', 'JavaScript'], 'performance_reviews': [{'review_date': '2020-05-14', 'rating': 5.0, 'comments': 'Outstanding performance and dedication.'}, {'review_date': '2019-12-21', 'rating': 3.2, 'comments': 'Consistently meets performance standards.'}], 'benefits': {'health_insurance': 'Bronze Plan', 'retirement_plan': '401K', 'paid_time_off': 21}, 'emergency_contact': {'name': 'Emily Johnson', 'relationship': 'Sibling', 'phone_number': '+1-555-708-4999'}, 'notes': 'Actively involved in company hackathons and innovation challenges.'}, page_content='Olivia Martinez, Female, born on 1971-11-05. Job: CEO in Executive. Skills: Kubernetes, Django, Python, JavaScript. Reviews: Rated 5.0 on 2020-05-14: Outstanding performance and dedication. Rated 3.2 on 2019-12-21: Consistently meets performance standards.. Location: Works at Tokyo Office, Remote: False. Notes: Actively involved in company hackathons and innovation challenges.'), 0.623656153678894)]\n",
            "---\n",
            "Type: AIMessage\n",
            "Content: The results show we have some iOS developers like Jane Doe with skills in iOS frameworks like Flask and Node.js. We also have developers with related skills like React, Django, Python etc.\n",
            "\n",
            "However, to build a full iOS app team, we may need to hire some dedicated iOS developers with strong expertise in Swift, Objective-C, Xcode, iOS SDK etc. We also need UI/UX designers experienced in iOS app design.\n",
            "\n",
            "Additionally, we may need iOS testers with experience in iOS automation testing frameworks like XCUITest, Appium etc.\n",
            "\n",
            "So the main talent gaps seem to be:\n",
            "\n",
            "1. Senior iOS developers with deep iOS platform expertise\n",
            "2. iOS UI/UX designers \n",
            "3. iOS testers/QA engineers\n",
            "\n",
            "We have a good base of general software developers, but could use some specialized iOS talent to build a robust iOS app team.\n",
            "---\n",
            "Type: AIMessage\n",
            "Content: [{'text': \"Okay, let's try to build a team for making an iOS app and identify any talent gaps using the available tool.\", 'type': 'text'}, {'id': 'toolu_0147LfjatFSoWVRFMHvvM6hV', 'input': {'query': 'iOS developer'}, 'name': 'lookup_employees', 'type': 'tool_use'}]\n",
            "---\n",
            "Type: ToolMessage\n",
            "Content: [(Document(metadata={'_id': {'$oid': '66869852751d346e9874bba3'}, 'employee_id': 'E123457', 'first_name': 'Jane', 'last_name': 'Doe', 'gender': 'Male', 'date_of_birth': '1975-02-11', 'address': {'street': '776 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'jane.doe@example.com', 'phone_number': '+1-555-127-2693'}, 'job_details': {'job_title': 'Senior Software Engineer', 'department': 'IT', 'hire_date': '2012-05-09', 'employment_type': 'Full-Time', 'salary': 214290, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Berlin Office', 'is_remote': True}, 'reporting_manager': 'M987654', 'skills': ['AWS', 'Django', 'React', 'Python'], 'performance_reviews': [{'review_date': '2021-09-23', 'rating': 3.4, 'comments': 'Outstanding performance and dedication.'}, {'review_date': '2019-02-23', 'rating': 4.8, 'comments': 'Outstanding performance and dedication.'}], 'benefits': {'health_insurance': 'Silver Plan', 'retirement_plan': '401K', 'paid_time_off': 17}, 'emergency_contact': {'name': 'Emily Doe', 'relationship': 'Spouse', 'phone_number': '+1-555-983-7930'}, 'notes': 'Received Employee of the Month award in 2022.'}, page_content='Jane Doe, Male, born on 1975-02-11. Job: Senior Software Engineer in IT. Skills: AWS, Django, React, Python. Reviews: Rated 3.4 on 2021-09-23: Outstanding performance and dedication. Rated 4.8 on 2019-02-23: Outstanding performance and dedication.. Location: Works at Berlin Office, Remote: True. Notes: Received Employee of the Month award in 2022.'), 0.6741443872451782), (Document(metadata={'_id': {'$oid': '66869852751d346e9874bba9'}, 'employee_id': 'E123463', 'first_name': 'Chris', 'last_name': 'Lee', 'gender': 'Female', 'date_of_birth': '1960-06-25', 'address': {'street': '958 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'chris.lee@example.com', 'phone_number': '+1-555-558-5576'}, 'job_details': {'job_title': 'DevOps Engineer', 'department': 'Operations', 'hire_date': '2017-02-05', 'employment_type': 'Full-Time', 'salary': 165112, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Singapore Office', 'is_remote': True}, 'reporting_manager': 'M987660', 'skills': ['Flask', 'Docker', 'SQL', 'JavaScript'], 'performance_reviews': [{'review_date': '2020-09-15', 'rating': 3.9, 'comments': 'Outstanding performance and dedication.'}, {'review_date': '2021-03-06', 'rating': 4.5, 'comments': 'Consistently meets performance standards.'}], 'benefits': {'health_insurance': 'Bronze Plan', 'retirement_plan': '401K', 'paid_time_off': 30}, 'emergency_contact': {'name': 'Michael Doe', 'relationship': 'Parent', 'phone_number': '+1-555-204-7780'}, 'notes': 'Received Employee of the Month award in 2022.'}, page_content='Chris Lee, Female, born on 1960-06-25. Job: DevOps Engineer in Operations. Skills: Flask, Docker, SQL, JavaScript. Reviews: Rated 3.9 on 2020-09-15: Outstanding performance and dedication. Rated 4.5 on 2021-03-06: Consistently meets performance standards.. Location: Works at Singapore Office, Remote: True. Notes: Received Employee of the Month award in 2022.'), 0.6641373038291931), (Document(metadata={'_id': {'$oid': '66869852751d346e9874bba2'}, 'employee_id': 'E123456', 'first_name': 'John', 'last_name': 'Doe', 'gender': 'Male', 'date_of_birth': '1988-01-17', 'address': {'street': '637 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'john.doe@example.com', 'phone_number': '+1-555-272-7205'}, 'job_details': {'job_title': 'Software Engineer', 'department': 'IT', 'hire_date': '2006-05-17', 'employment_type': 'Full-Time', 'salary': 150040, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Paris Office', 'is_remote': False}, 'reporting_manager': 'M987654', 'skills': ['Flask', 'AWS', 'Kubernetes', 'JavaScript'], 'performance_reviews': [{'review_date': '2020-12-26', 'rating': 4.2, 'comments': 'Outstanding performance and dedication.'}, {'review_date': '2020-03-09', 'rating': 3.8, 'comments': 'Consistently meets performance standards.'}], 'benefits': {'health_insurance': 'Gold Plan', 'retirement_plan': '401K', 'paid_time_off': 22}, 'emergency_contact': {'name': 'Jane Smith', 'relationship': 'Spouse', 'phone_number': '+1-555-112-8267'}, 'notes': 'Completed leadership training in 2021.'}, page_content='John Doe, Male, born on 1988-01-17. Job: Software Engineer in IT. Skills: Flask, AWS, Kubernetes, JavaScript. Reviews: Rated 4.2 on 2020-12-26: Outstanding performance and dedication. Rated 3.8 on 2020-03-09: Consistently meets performance standards.. Location: Works at Paris Office, Remote: False. Notes: Completed leadership training in 2021.'), 0.663453996181488), (Document(metadata={'_id': {'$oid': '66869852751d346e9874bba8'}, 'employee_id': 'E123462', 'first_name': 'David', 'last_name': 'Wilson', 'gender': 'Male', 'date_of_birth': '1959-11-27', 'address': {'street': '733 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'david.wilson@example.com', 'phone_number': '+1-555-241-5326'}, 'job_details': {'job_title': 'QA Engineer', 'department': 'Quality Assurance', 'hire_date': '2007-09-21', 'employment_type': 'Full-Time', 'salary': 157693, 'currency': 'USD'}, 'work_location': {'nearest_office': 'New York Office', 'is_remote': True}, 'reporting_manager': 'M987659', 'skills': ['Node.js', 'Flask', 'React', 'Django'], 'performance_reviews': [{'review_date': '2023-04-16', 'rating': 3.1, 'comments': 'Consistently meets performance standards.'}, {'review_date': '2021-04-14', 'rating': 4.7, 'comments': 'Exceeded expectations in the last project.'}], 'benefits': {'health_insurance': 'Silver Plan', 'retirement_plan': '401K', 'paid_time_off': 19}, 'emergency_contact': {'name': 'Robert Johnson', 'relationship': 'Spouse', 'phone_number': '+1-555-773-9005'}, 'notes': 'Received Employee of the Month award in 2022.'}, page_content='David Wilson, Male, born on 1959-11-27. Job: QA Engineer in Quality Assurance. Skills: Node.js, Flask, React, Django. Reviews: Rated 3.1 on 2023-04-16: Consistently meets performance standards. Rated 4.7 on 2021-04-14: Exceeded expectations in the last project.. Location: Works at New York Office, Remote: True. Notes: Received Employee of the Month award in 2022.'), 0.6592249274253845), (Document(metadata={'_id': {'$oid': '66869852751d346e9874bba5'}, 'employee_id': 'E123459', 'first_name': 'Michael', 'last_name': 'Brown', 'gender': 'Female', 'date_of_birth': '1975-09-03', 'address': {'street': '887 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'michael.brown@example.com', 'phone_number': '+1-555-391-5648'}, 'job_details': {'job_title': 'Product Manager', 'department': 'Product', 'hire_date': '2000-06-02', 'employment_type': 'Full-Time', 'salary': 100877, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Sydney Office', 'is_remote': False}, 'reporting_manager': 'M987656', 'skills': ['Kubernetes', 'SQL', 'React', 'Python'], 'performance_reviews': [{'review_date': '2021-03-16', 'rating': 3.7, 'comments': 'Consistently meets performance standards.'}, {'review_date': '2019-03-07', 'rating': 3.7, 'comments': 'Exceeded expectations in the last project.'}], 'benefits': {'health_insurance': 'Gold Plan', 'retirement_plan': '401K', 'paid_time_off': 20}, 'emergency_contact': {'name': 'Emily Johnson', 'relationship': 'Sibling', 'phone_number': '+1-555-495-9940'}, 'notes': 'Promoted to Senior Software Engineer in 2020.'}, page_content='Michael Brown, Female, born on 1975-09-03. Job: Product Manager in Product. Skills: Kubernetes, SQL, React, Python. Reviews: Rated 3.7 on 2021-03-16: Consistently meets performance standards. Rated 3.7 on 2019-03-07: Exceeded expectations in the last project.. Location: Works at Sydney Office, Remote: False. Notes: Promoted to Senior Software Engineer in 2020.'), 0.6550472974777222), (Document(metadata={'_id': {'$oid': '66869852751d346e9874bbaa'}, 'employee_id': 'E123464', 'first_name': 'Sophia', 'last_name': 'Garcia', 'gender': 'Male', 'date_of_birth': '1971-05-23', 'address': {'street': '517 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'sophia.garcia@example.com', 'phone_number': '+1-555-194-1655'}, 'job_details': {'job_title': 'CTO', 'department': 'Executive', 'hire_date': '2009-05-03', 'employment_type': 'Full-Time', 'salary': 144266, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Chicago Office', 'is_remote': True}, 'reporting_manager': None, 'skills': ['Django', 'SQL', 'JavaScript', 'React'], 'performance_reviews': [{'review_date': '2023-11-25', 'rating': 4.2, 'comments': 'Outstanding performance and dedication.'}, {'review_date': '2021-06-06', 'rating': 3.8, 'comments': 'Outstanding performance and dedication.'}], 'benefits': {'health_insurance': 'Gold Plan', 'retirement_plan': '401K', 'paid_time_off': 18}, 'emergency_contact': {'name': 'Robert Johnson', 'relationship': 'Sibling', 'phone_number': '+1-555-889-5436'}, 'notes': 'Completed leadership training in 2021.'}, page_content='Sophia Garcia, Male, born on 1971-05-23. Job: CTO in Executive. Skills: Django, SQL, JavaScript, React. Reviews: Rated 4.2 on 2023-11-25: Outstanding performance and dedication. Rated 3.8 on 2021-06-06: Outstanding performance and dedication.. Location: Works at Chicago Office, Remote: True. Notes: Completed leadership training in 2021.'), 0.6511964797973633), (Document(metadata={'_id': {'$oid': '66869852751d346e9874bba6'}, 'employee_id': 'E123460', 'first_name': 'Sarah', 'last_name': 'Davis', 'gender': 'Female', 'date_of_birth': '1999-02-08', 'address': {'street': '468 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'sarah.davis@example.com', 'phone_number': '+1-555-835-2280'}, 'job_details': {'job_title': 'Project Manager', 'department': 'Project Management', 'hire_date': '2005-01-06', 'employment_type': 'Full-Time', 'salary': 168358, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Toronto Office', 'is_remote': False}, 'reporting_manager': 'M987657', 'skills': ['AWS', 'Kubernetes', 'Node.js', 'SQL'], 'performance_reviews': [{'review_date': '2022-06-01', 'rating': 3.1, 'comments': 'Exceeded expectations in the last project.'}, {'review_date': '2021-07-18', 'rating': 3.8, 'comments': 'Needs improvement in time management.'}], 'benefits': {'health_insurance': 'Silver Plan', 'retirement_plan': '401K', 'paid_time_off': 21}, 'emergency_contact': {'name': 'Emily Doe', 'relationship': 'Friend', 'phone_number': '+1-555-274-3508'}, 'notes': 'Completed leadership training in 2021.'}, page_content='Sarah Davis, Female, born on 1999-02-08. Job: Project Manager in Project Management. Skills: AWS, Kubernetes, Node.js, SQL. Reviews: Rated 3.1 on 2022-06-01: Exceeded expectations in the last project. Rated 3.8 on 2021-07-18: Needs improvement in time management.. Location: Works at Toronto Office, Remote: False. Notes: Completed leadership training in 2021.'), 0.6394219994544983), (Document(metadata={'_id': {'$oid': '66869852751d346e9874bba4'}, 'employee_id': 'E123458', 'first_name': 'Emily', 'last_name': 'Smith', 'gender': 'Male', 'date_of_birth': '1996-04-26', 'address': {'street': '613 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'emily.smith@example.com', 'phone_number': '+1-555-807-1477'}, 'job_details': {'job_title': 'Data Scientist', 'department': 'Data Science', 'hire_date': '2013-02-05', 'employment_type': 'Full-Time', 'salary': 249844, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Paris Office', 'is_remote': False}, 'reporting_manager': 'M987655', 'skills': ['Flask', 'AWS', 'Kubernetes', 'Python'], 'performance_reviews': [{'review_date': '2021-08-27', 'rating': 4.3, 'comments': 'Consistently meets performance standards.'}, {'review_date': '2022-11-01', 'rating': 3.3, 'comments': 'Outstanding performance and dedication.'}], 'benefits': {'health_insurance': 'Gold Plan', 'retirement_plan': '401K', 'paid_time_off': 27}, 'emergency_contact': {'name': 'Robert Smith', 'relationship': 'Sibling', 'phone_number': '+1-555-935-5927'}, 'notes': 'Promoted to Senior Software Engineer in 2020.'}, page_content='Emily Smith, Male, born on 1996-04-26. Job: Data Scientist in Data Science. Skills: Flask, AWS, Kubernetes, Python. Reviews: Rated 4.3 on 2021-08-27: Consistently meets performance standards. Rated 3.3 on 2022-11-01: Outstanding performance and dedication.. Location: Works at Paris Office, Remote: False. Notes: Promoted to Senior Software Engineer in 2020.'), 0.6281063556671143), (Document(metadata={'_id': {'$oid': '66869852751d346e9874bbab'}, 'employee_id': 'E123465', 'first_name': 'Olivia', 'last_name': 'Martinez', 'gender': 'Male', 'date_of_birth': '1998-01-20', 'address': {'street': '365 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'olivia.martinez@example.com', 'phone_number': '+1-555-782-9169'}, 'job_details': {'job_title': 'CEO', 'department': 'Executive', 'hire_date': '2016-10-24', 'employment_type': 'Full-Time', 'salary': 116724, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Berlin Office', 'is_remote': False}, 'reporting_manager': None, 'skills': ['AWS', 'Python', 'React', 'Kubernetes'], 'performance_reviews': [{'review_date': '2022-08-03', 'rating': 4.8, 'comments': 'Outstanding performance and dedication.'}, {'review_date': '2019-07-10', 'rating': 3.4, 'comments': 'Exceeded expectations in the last project.'}], 'benefits': {'health_insurance': 'Silver Plan', 'retirement_plan': '401K', 'paid_time_off': 22}, 'emergency_contact': {'name': 'Michael Smith', 'relationship': 'Spouse', 'phone_number': '+1-555-265-8828'}, 'notes': 'Received Employee of the Month award in 2022.'}, page_content='Olivia Martinez, Male, born on 1998-01-20. Job: CEO in Executive. Skills: AWS, Python, React, Kubernetes. Reviews: Rated 4.8 on 2022-08-03: Outstanding performance and dedication. Rated 3.4 on 2019-07-10: Exceeded expectations in the last project.. Location: Works at Berlin Office, Remote: False. Notes: Received Employee of the Month award in 2022.'), 0.6254255175590515), (Document(metadata={'_id': {'$oid': '66869852751d346e9874bba7'}, 'employee_id': 'E123461', 'first_name': 'Robert', 'last_name': 'Johnson', 'gender': 'Male', 'date_of_birth': '1953-06-04', 'address': {'street': '631 Main Street', 'city': 'Springfield', 'state': 'IL', 'postal_code': '62704', 'country': 'USA'}, 'contact_details': {'email': 'robert.johnson@example.com', 'phone_number': '+1-555-339-6801'}, 'job_details': {'job_title': 'UX Designer', 'department': 'Design', 'hire_date': '2009-01-13', 'employment_type': 'Full-Time', 'salary': 140608, 'currency': 'USD'}, 'work_location': {'nearest_office': 'Tokyo Office', 'is_remote': True}, 'reporting_manager': 'M987658', 'skills': ['Django', 'Docker', 'Node.js', 'Python'], 'performance_reviews': [{'review_date': '2021-11-05', 'rating': 3.9, 'comments': 'Needs improvement in time management.'}, {'review_date': '2021-04-13', 'rating': 4.0, 'comments': 'Needs improvement in time management.'}], 'benefits': {'health_insurance': 'Bronze Plan', 'retirement_plan': '401K', 'paid_time_off': 17}, 'emergency_contact': {'name': 'Jane Johnson', 'relationship': 'Sibling', 'phone_number': '+1-555-589-8955'}, 'notes': 'Completed leadership training in 2021.'}, page_content='Robert Johnson, Male, born on 1953-06-04. Job: UX Designer in Design. Skills: Django, Docker, Node.js, Python. Reviews: Rated 3.9 on 2021-11-05: Needs improvement in time management. Rated 4.0 on 2021-04-13: Needs improvement in time management.. Location: Works at Tokyo Office, Remote: True. Notes: Completed leadership training in 2021.'), 0.6193082332611084)]\n",
            "---\n",
            "Type: AIMessage\n",
            "Content: Based on the employee lookup, we have:\n",
            "\n",
            "iOS Developers: \n",
            "- Jane Doe (Senior Software Engineer with React skills)\n",
            "\n",
            "Other Relevant Roles:\n",
            "- Chris Lee (DevOps Engineer)\n",
            "- John Doe (Software Engineer with JavaScript skills) \n",
            "- David Wilson (QA Engineer)\n",
            "- Sophia Garcia (CTO with React skills)\n",
            "- Olivia Martinez (CEO with React skills)\n",
            "\n",
            "Talent Gaps:\n",
            "- We only have 1 employee with direct iOS development experience (Jane Doe)\n",
            "- To build a full iOS app team, we likely need:\n",
            "    - Additional iOS developers \n",
            "    - UI/UX designers for iOS\n",
            "    - iOS QA/testers\n",
            "    - Project manager experienced in iOS app development\n",
            "- We may also need additional skills like Swift, Objective-C, XCode, iOS frameworks/libraries etc.\n",
            "\n",
            "So in summary, while we have some relevant engineering talent, we have a significant talent gap in dedicated iOS app development skills and roles to build a full team for this project.\n",
            "---\n"
          ]
        }
      ],
      "source": [
        "import pprint\n",
        "from typing import Dict, List\n",
        "\n",
        "from langchain_core.messages import BaseMessage, HumanMessage, ToolMessage\n",
        "\n",
        "events = graph.stream(\n",
        "    {\n",
        "        \"messages\": [\n",
        "            HumanMessage(\n",
        "                content=\"Build a team to make an iOS app, and tell me the talent gaps\"\n",
        "            )\n",
        "        ]\n",
        "    },\n",
        "    {\"recursion_limit\": 15},\n",
        ")\n",
        "\n",
        "\n",
        "def process_event(event: Dict) -> List[BaseMessage]:\n",
        "    new_messages = []\n",
        "    for value in event.values():\n",
        "        if isinstance(value, dict) and \"messages\" in value:\n",
        "            for msg in value[\"messages\"]:\n",
        "                if isinstance(msg, BaseMessage):\n",
        "                    new_messages.append(msg)\n",
        "                elif isinstance(msg, dict) and \"content\" in msg:\n",
        "                    new_messages.append(\n",
        "                        AIMessage(\n",
        "                            content=msg[\"content\"],\n",
        "                            additional_kwargs={\"sender\": msg.get(\"sender\")},\n",
        "                        )\n",
        "                    )\n",
        "                elif isinstance(msg, str):\n",
        "                    new_messages.append(ToolMessage(content=msg))\n",
        "    return new_messages\n",
        "\n",
        "\n",
        "for event in events:\n",
        "    print(\"Event:\")\n",
        "    pprint.pprint(event)\n",
        "    print(\"---\")\n",
        "\n",
        "    new_messages = process_event(event)\n",
        "    if new_messages:\n",
        "        temp_mem.add_messages(new_messages)\n",
        "\n",
        "print(\"\\nFinal state of temp_mem:\")\n",
        "if hasattr(temp_mem, \"messages\"):\n",
        "    for msg in temp_mem.messages:\n",
        "        print(f\"Type: {msg.__class__.__name__}\")\n",
        "        print(f\"Content: {msg.content}\")\n",
        "        if msg.additional_kwargs:\n",
        "            print(\"Additional kwargs:\")\n",
        "            pprint.pprint(msg.additional_kwargs)\n",
        "        print(\"---\")\n",
        "else:\n",
        "    print(\"temp_mem does not have a 'messages' attribute\")"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": 25,
      "metadata": {
        "id": "mIvSJELf4yxQ"
      },
      "outputs": [],
      "source": []
    }
  ],
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    },
    "language_info": {
      "name": "python"
    },
    "widgets": {
      "application/vnd.jupyter.widget-state+json": {
        "state": {}
      }
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}
